Advertisement

Finding Game Servers

Started by November 17, 2002 04:57 AM
7 comments, last by Fma 22 years, 2 months ago
Hi: What is the beast way to detect available game servers?? [edited by - Fma on November 17, 2002 5:59:17 AM]
for (int ip = 1; ip != 0; ++ip)	for (int port = 0; port < 65536; ++port)		if (ping_server(ip, port))			add_server(ip, port, get_server_info(ip, port)); 

Advertisement
Heh, while niyaw''s version works, it''s not the most efficient method in the world...

I guess the standard way is to have a central "server database", where servers register themselves whenever they start up. The client connects to this database and downloads the list of servers.

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

How can the client ping the server and how does the server respond to the ping??
You''re in over your head.
quote:
Original post by Anonymous Poster
You''re in over your head.


I think you''re right. If you don''t understand the concept of a ping, then you''re in a bit of trouble...

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Advertisement
Plz explain.
Well, a ping is probably the simplest idea in networking. If you don''t understand how that works, then I don''t know how you''re going to go with everything else.

The way a ping works is the client sends a packet to the server, the server replies with the same (or similar) packet. You can make it a bit more complex, including timestamps and so on so that you can synchornise clocks or whatever you want to do, but that might be getting a bit advanced.

I recommend getting yourself a good book on networking before you go much further. It''ll really help to get a good overview of the whole topic.

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Thanx

This topic is closed to new replies.

Advertisement