Searching for games
I have a question: I am working in a game. When a client wants to search for games, for example, in a LAN, he has to recevive the response of all servers that host a game. My problem is: I don''t know a way for the client only to connect to the servers that are hosting. I tried to use connect() on all IPs (from 1 to 255), but this function is too slow when the IP is not hosting. Is there way for the client use the connect() function only on the IPs that are possible?
I assume you know how to broadcast UDP across the LAN. You need to design a minimal protocol whereby the client polls the LAN and the servers respond "I have an active game". Then, you know that you can safely connect() to that address... well, assuming there aren''t artificial restrictions like max number of players already reached... but that kind of info should be part of the server''s response.
August 02, 2003 12:04 PM
You might also try UDP multicast instead of broadcasting. A lot of people are really really against broadcasting. I have used multicasting that way on several different networks, and so far they all have worked fine. I''m not sure what the actual maximum is for the number of recipients when multicasting, but you''ll probably be fine.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement