SFML community forums

Help => Network => Topic started by: Pwndja on July 24, 2008, 08:28:58 pm

Title: Broadcasting a Server
Post by: Pwndja on July 24, 2008, 08:28:58 pm
If I want to have a server broadcast its IP address to my clients how would I go about doing this.
I am using UDP sockets. I want to be able to have a server running and wait for clients to connect to it, but I don't want the client side to have a static server IP address in my code, instead I would like to have the client find the server's address.
Another thing is it only has to find the server on a LAN NOT through the internet or a DNS name.

any advice or help is much appreciated.

Thanks in advance
Title: Broadcasting a Server
Post by: Daazku on July 25, 2008, 02:24:07 am
Arg ... The best solution is through a DNS XD.
Title: Broadcasting a Server
Post by: Laurent on July 25, 2008, 02:55:10 am
Don't know if it's the most efficient solution, but you can send a particular message on a particular port to the whole LAN (using UDP broadcasting), and wait for a reply from the server indicating its address.
Title: Broadcasting a Server
Post by: Mindiell on July 25, 2008, 06:36:28 am
This is the only solution on a LAN. You can only reach a server on the same address type than your IP. Today, each network interface can block the Broadcast and usually do it, so you have to stay on your little network.

An other idea is to show the server IP on the server screen when the app runs, and each client can know it easily (since a LAN is often on small areas).
Title: Broadcasting a Server
Post by: e_barroga on August 27, 2008, 04:03:22 am
The easiest way I know is making a dedicated master server that keeps track of people that host games. Then the people that join communicate with the master server to determine if an existing game is present.