Android to Android TCP Connection

All of the documentation, examples and questions I've seen so far on TCP connections with Android have been between an Android device and a computer. As unreliable as wireless can be, is it possible to make a client-server TCP connection between Android devices over WiFi, and if so, how?

Edit: I guess I should elaborate more on my situation. My Droid does not respond to ping or accept incoming TCP requests from anything unless I first make the Droid a client and my laptop the server. After this initial connection is established I can then ping from my laptop, or make the Droid a server and my laptop the client. What I can't do is make one Droid the server and another a client, I always get a "No route to host" error.

It feels like there is something blocking incoming connections unless the device initiates a connection to something else, and even then the only request the device will accept is with this device. How can I make my Droid a server that accepts all incoming TCP requests from any device on my local intranet?


You should be able to. Just do like you would do with computer/device connections, except run the client and server code on the devices.

One of the neat things about the Internet is that the Internet doesn't care whether you are establishing a connection between two PC's, a PC and a phone, or two phones. I would look at the Socket documentation, that should be enough to get you rolling.

It's certainly possible. The only problem is figuring out the IP address. I don't expect a phone have a fixed IP... However, if there is a fixed "login" server somewhere in the Web which IP is known to both phones then they can do a handshake via that server and after that continue peer-to-peer.

re; The only problem is figuring out the IP address. I don't expect a phone have a fixed IP.

Try this; Use the web browser on the phone to log into this website: It should provide you the IP address.

Need Your Help

Change background image with remember feature

javascript jquery cookies background-image

im currently creating a site where i want people to be able to change the background image. i have the script to change working just fine, but i'd like to include a "remember" feature.

how to post Base64 encoded image to server using $.ajax?

javascript php jquery ajax cordova

I am making a phonegap app, in which the user submits a photo from his camera, i get it in a Base64 encoding form.