[ENet-discuss] Finding LAN server IP address
Peter Soxberger
Peter.Soxberger at gmx.net
Fri Aug 14 04:35:21 PDT 2009
Yes this can be done easily with udp. Send a message to the ip 255.255.255.255 => the message will be sent to all hosts in the LAN. The server answers and now the client has the ip of the server.
You could also use the IP 255.255.255.255 as serverip when you connect the ENet client, then it will search for the server itself and you want need udp.
Best regards,
Petere
-------- Original-Nachricht --------
> Datum: Fri, 14 Aug 2009 10:58:33 +0200
> Von: "Emmanuel Astier" <eastier at ubisoft.fr>
> An: "Discussion of the ENet library" <enet-discuss at cubik.org>
> Betreff: Re: [ENet-discuss] Finding LAN server IP address
> For a LAN session, the client broadcast a message « is there any server
> out there », on a specific port.
>
> The server listens to this port, get the message and send a response ( as
> a broadcast usually so every client can see any changes in the server ) "Am
> I a server here, with my IP : XXX" ( and perhaps some other useful
> informations ).
>
> Now the client has received the response, so he can do whatever he
> wants...
>
>
>
> Hope it helps,
>
>
>
> Emmanuel
>
>
>
> De : enet-discuss-bounces at cubik.org
> [mailto:enet-discuss-bounces at cubik.org] De la part de William Brandt
> Envoyé : vendredi 14 août 2009 10:15
> À : Discussion of the ENet library
> Objet : Re: [ENet-discuss] Finding LAN server IP address
>
>
>
> Jonathan Hodgkinson wrote:
>
> Sorry if this is a basic question: I'm trying to setup a local game over
> wifi. So one client will create the 'server' and the other clients will try
> and join as clients. The problem is on a local LAN it seems they have to
> connect to the locally assigned IP of that server but I dont know how to get
> this through the code.
>
> I can get the client to connect to the server by manually finding the IP
> say 192.168.4 but I need to get this through the code.
>
> Does this mean I have to get the server to do some kind of broadcasting?
>
> Thanks in advance!
>
>
>
>
>
>
> ________________________________
>
>
>
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
> The client-side needs to know either the ip address (whether local or
> external) of the server, or a hostname which resolves to the right ip address.
> You can use a free dns service, such as dyndns, to resolve to an ip
> address which you can change at any time without modifying the code. This would
> require you to have external internet access though, and wouldn't work on a
> local lan which isn't connected to the internet. Other than that, the
> only way to do it would be to have the user supply the ip address to connect
> to. All of the games I've played which support tcp/ip play use this method
> if they don't have a centralized server with a static ip that organizes all
> other servers.
>
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the ENet-discuss
mailing list