Sign in to follow this  

Get your games servers list

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

I would to know how i can do a list of all servers of my game, i thought try all ips but it will be not optimized so i ask you if there is a better way, thanks icon_smile.gif

 

(i use SDL_Net if you want to know)

Share this post


Link to post
Share on other sites
Trying all IP addresses is not feasible, nor is it reasonable.

For finding LAN servers, you can issue a broadcast a specifically formatted UDP packet to a known port. Each server would be listening on this port, and would respond to such packets with information about how to connect to them.

For finding servers on the Internet, most games have a well known central server which is run by the game's owner. Third party game servers will contact this central server on startup, which registers their details with it. Clients can query the central server for a list of game servers. This central server can also help achieve NAT punch-through, which is a common problem on the public Internet.

Share this post


Link to post
Share on other sites
Simplest thing that works:
Build a service that receives "I'm alive" messages from each game server. When you receive that message, list it as "alive" for the next 10 seconds, using the address you saw as sender of the "I'm alive" message. Have a timer that removes old servers (older than 10 seconds) once a second or so. Have the server re-send the "I'm alive" message every 5 seconds while it still wants to be listed.

Share this post


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