Android socket networking - android

I had this chat program using sockets and ip addresses.
I tried the code and was working perfectly on my android devices connected via wifi to my router.
I've got the client and server codes from here http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/
The code gets the ip address assigned by the router to the android device. The problem is how will I be able to communicate an android device connected to the Router A via wifi to an android device connected to Router B?

Related

Can we get the IP address of a server(iot device) if we have the URL in flutter

I have a device connected to the local network, acting as a web server, and have mdns built init.
Can I somehow get the IP address of the device using an app built with flutter?
HTTP requests work perfectly fine if I remain connected to the same wifi. But when my phone gets connected to any other wifi some time it does not work.

Cannot create socket connection to Android device running hotspot

I have an Android phone running a hotspot and an app with a server socket running on port 10000.
The phones IP address is 192.168.43.1.
Another phone connects to the hotspot (address is 192.168.43.6) and tries to establish a socket to the other phone running the hotspot.
But that socket creation fails with a connection timeout.
Ping works in both directions and it works when both phone are connected to a regular WiFi router.
Is there some extra work required to get this scenario working on Android?
It looks like this is not possible: https://stackoverflow.com/a/17928091/2445758
You cannot open a connection to the phone acting as a hotspot from a client.

Android Wifi-Hotspot Port Forwarding

How can I make a port forwarding from a android device whose Hotspot is ON to another device who is connected to that hotspot.
I want to connect to my system server which is connected to a android Hotspot from another device which is in another network. When I use the pubilc IP of the Hotspot device I am getting access to that device only, I am not able to access to other device which is connected to it.
As how the WIFI-router provides the port forwarding in the same case I want in android when I am using Hotspot.

Using Socket to connect to Server in Pc from mobile

I wrote an app to connect to java server running in PC. It works fine in emulator but its not working when i try the same from my mobile. I used the Mobiles 3G network to connect to IP address.
(Based on question comment)
I assume that your server application is running on the same machine as the android emulator. In this case the emulator can reach your server with 10.0.2.2.
If you're trying to contact your server via mobile 3G you have to use the IP of your Internet connection (What is my IP?). The request will reach your router. The router has to forward this request to your server machine. So if your server has a local IP 192.168.0.10 and it listens to port 2412 your router should forward all incoming request for this TCP port to this IP.
You should allow the 3G internet in Settings. (Emulator doesn't need this, it uses ethernet connection of your PC).
Your application should diagnose the state and possibilities of Internet connection and report it to you as a user of the debug mode. Or/and something - to the usual user.

Connecting Android phone to a mac on network with name.local not IP

I'm trying to do some local web dev/testing and connect from my FroYo Android device to my mac via it's 'name.local' address on the network, rather than via it's IP.
Is this possible? My device refuses to connect, but works with IP.
I have to use name.local due to the nature of the site I'm developing - the domain name has to remain static.

Categories

Resources