Archived

This topic is now archived and is closed to further replies.

Detecting all games/servers running on network

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

Hello, I''m trying to write a game that can run over a network or the internet. My code for the internet works fine, but I really don''t know the differences/similarities of doing it over a network. What I really want to know how to do is display all servers for game X on a local network. Thanks a lot for any help, Brian

Share this post


Link to post
Share on other sites
On whatever port your server listens on, you''ll want to send out a packet from the client to the broadcast address for the given subnet, and to the server port. On the server, when you get one of these requests, you respond with some server info.

Share this post


Link to post
Share on other sites
Thanks for the lead. This may be a stupid question, but how do I figure out what the broadcast address is? Also, how would I detect someone sent out a request? Sorry for the ignorance,

Brian

Share this post


Link to post
Share on other sites
You''re absolutly right. But you don''t even need to be that detailed; just 255.255.255.255 will get everything on the same network segment. The computer doesn''t care about the network adress when it comes to broadcasts. Since routers won''t forward them, the computer just assumes it''s from the same network. In fact, if your address is A.B.C.D, theres no guarantee that A.B.C.255 will actually get you the right network. It just creates more work to take into account the subnet mask and what class of network you have. So just use 255.255.255.255.

Share this post


Link to post
Share on other sites
Thanks a lot guys. One more quick question. Doing this is only possible with UDP, correct? And not TCP? I''ve already started rewriting my code to work with UDP because I heard that was the case. (not a big deal, I knew I''d have to do it anyways) Just wondering though.

Thanks again for the help,

Brian

Share this post


Link to post
Share on other sites