tags:

views:

455

answers:

3

I am using the reachability code from apple to find if my iphone is connected to the wifi. Next i would like to list all the devices that are in my wifi range. How should i do this. The other devices do not publish any service. I want to detect all devices in my wifi range and send that device a request for tcp connection.

+1  A: 

If a device does not advertise its presence and is not otherwise active, TCP/IP does not give you a way to "detect" it. If you can identify your subnet (which has nothing to do with a "wifi range", whatever that may be), you can try connecting to each possible host in it on all possible ports -- this is generally considered an attack (what legitimate reason could you have for such a port scan?), so, if you're detected trying this attack, be prepared for the consequences.

Alex Martelli
A: 

As @Alex says, even if you could find devices that weren't advertising, what's the point? You can't most likely do any adhoc communications with them. Instead you'd need to find copies of your application running on connected devices, and your app needs to advertise.

Take a look at Gamekit sample projects which will give you bluetooth connectivity, and you could dig into something like Jens Alfke's MyNetwork and Blip libraries for tcp/wifi. http://jens.mooseyard.com/2008/05/blip-come-n-get-it/

wkw
A: 

@wkw i m looking for a similar solution for my app ie to detect other iphones in proximity running the same app. How d u suggest i do that? Do i need to have my app running all the time in both the devices to achieve this?

venkat