Sign in to follow this  
carl404

wi-fi / scan for IP addresses

Recommended Posts

Hi, I want to use an ad-hoc wi-fi connection in my game. It's on Pocket PC platform so I expect that there will be several other devices near me. The problem is that the IP address is generated randomly so I don't know what will be the IP of the device I want to connect to. Is thera a way to do a fast scan that would acquire IPs of all that is connected to my local ad-hoc network ??

Share this post


Link to post
Share on other sites
The usual way to do this on a wired LAN is to broadcast a "I'm here" message to a well-known port. Anybody who cares can then reply (either directed or via broadcast as well) and you have a conversation.

In standard socket lingo listeners need to create a socket and bind it to INADDR_BROADCAST with whatever port you pick. Senders (maybe both sides, it's been a while) need to call setsockopt with the SO_BROADCAST option to enable broadcast support. Broadcast support is UDP only as well.

I don't know how easily that translates to Pocket PC though. I imaging all those devices are a bit different.

You might be able to get away with multicast in this scenario. Again, it probably depends on your device.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this