Jump to content
  • Advertisement
Sign in to follow this  
carl404

wi-fi / scan for IP addresses

This topic is 4791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
You can issue a broadcast ping and listen for the results to detect general nodes on the network (requires you to write ICMP code on top of a raw socket).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!