Jump to content
  • Advertisement
Sign in to follow this  
BANE000

Server broadcasting to find clients

This topic is 4724 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

In the FAQ it says that finding your own IP is A Bad Thing(tm), so what would be the best manner to send a broadcast message to announce that there is a server available for clients to join? Obviously, if finding the local IP is a valid design concept, then it would be simple to determine the class of the address and replace the appropriate number of fields with 255. This is simple but not very elegant. Is there a better way? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Most routers will filter UDP broadcasts. Thus, if you broadcast on the "Mars" address (255.255.255.255) and on your specific port, then the local machines that see your server will know where to reply back to, because the return address will be in their call to recvfrom(). Note that you need to do a special socket ioctl() before you're allowed to broadcast.

If you want to announce availability of the server wider than your local subnet, you have to use some sort of separate look-up, such as a known server/roster/introducer, or just plain DNS. Multicast is not really an alternative, because it's not well supported on the Internet in general (probably because it's a pretty poor match to today's Internet).

Share this post


Link to post
Share on other sites
Well, if what you want to do is have a server with a non static ip then yes some kind of dns service with something like no-ip.org is appropriate.

But it sounds as if you're thinking of being able to see servers as in say Quake, Half-Life, Starcraft, Diablo etc. These games just use a known central server where all the player servers report their status and availability.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!