Click here to Skip to main content
15,851,319 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys,

I am making a game at the moment and I am writing the server for it in C#. I have chosen to use TCP and have made a server, but you have to type in an ip and everything. I was wondering if I am able to do like a lobby thing where it scans for open servers on the assigned port so you know what servers are open.

thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 23-Jan-13 23:59pm    
Some approach like that is quite possible, but please explain your idea more clearly. Do you want to scan through a set of ports on some preliminary known IP, or do you want to scan a set if IPs to find the service? Or both? Do you want to scan on service host, client host or both?
What do you think is the problem? How to recognize the match, or what?
And do you know which ports are valid?
—SA
Hariharan Arunachalam 27-Jan-13 16:22pm    
To use TCP based com in the form of a 'lobby' you'd need to know the ip and ports of the remote clients or the server information at the client. Otherwise you can scan all possible ip+port combinations. (Not a good idea. At all!). I'd suggest using a UDP broadcast to connect to the server and then you could switch to TCP for the rest of the communication. Sounds good?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900