Reputation: 55
I want to run a socket server on android, and read/write data from/to other android devices with different networks.
Here is the problem:
What should I do, to link two or more android devices with sockets from different networks?
The main point is run server on any of that devices (client-server code in one app).
Upvotes: 0
Views: 192
Reputation: 9282
You do not have to bind your server socket to an ip address. Just dont call bind().
Further your server is only reachable if it runs on an Android device connected with wifi to a router.
If the Android device is on mobile connection your server is not reachable. –
Upvotes: 1
Reputation: 321
You can't bind to an address you don't have.
You need (a) to bind to an interface on your android device, and (b) arrange port forwarding / open the firewall (depends on router+network config) from your router to your android device.
Upvotes: 1