Search code examples
androidandroid-wifi

Peer-Peer communication using wi-fi in android


I want to send a message from one android device to another through Wi-Fi.

I have two android devices , and Portable wifi Hotspot is enabled on both. I developed an application which displays a list of availabe wifi devices , and both of the devices lists each other.

Now I want to connect both and send a text from one device to another. What I know is that wifi transmitters transmit a beacon frame , which contains SSID , BSSID etc.

What should I do ? Should I apply a socket operation , but I don't have IP address.


Solution

  • I haven't done this so I can't provide code, but the answer is to use wifi- direct. http://developer.android.com/guide/topics/connectivity/wifip2p.html. That allows you to discover devices on wifi with you, then send data to them via normal sockets.

    There is a wifi-direct sample app with the SDK.