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 : [email protected] [mailto:[email protected]] 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 [email protected] 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.
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
