Possible Duplicate:
Connect two android phones with wi-fi (without laptop or access point) and send file
I would like to build an app, which communicates between two android phones through Wifi. They should be able to communicate (e.g. send message) without internet access. So the users only need to have the same app installed and Wifi activated. I don't want to use Bluetooth or NFC (reason: wifi has wider range). It would be great, if it would works with Android 2.2. I search a lot of stackoverflow questions, but I couldn't find that exact case.
So far I was able to active a wifi hotspot (access point) on one android and let a second device access that connection. The problem is that the other device gets also internet access. But I only want to allow these two devices to communicate not needing the internet. Would it be possible to restrict the hotspot connection not allowing the internet access?
Another option is called "Wifi direct", which will only work for Android from 4.0 or later. Is there something similar for devices below 4.0?
Further I read about socket. Am I right, that I will need to be in the same wireless lan network to communicate or I will need internet access? Are sockets usable for my case?
Which option would you suggest and am I missing any options here?