Thanks for the replies. I do seem to have had some success with setting the server with:
address.host = ENET_HOST_ANY; And then the client as address.host = ENET_HOST_BROADCAST; Once connected it seems to work fine, but it does seem flaky to connect sometimes. I've also found that decreasing the timeout time for the client seems to have improved matter eg enet_host_service(sClient, &event, 100) (from like 5000). Im happy with this, but Im not sure why it works, and I want to be sure that it will work on others routers/LANS etc (I've manged to test it on one router so far and it also worked there) Any hints on how/why it works and if its reliable would be great! thanks again. 2009/8/14 <[email protected]> > Send ENet-discuss mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.cubik.org/mailman/listinfo/enet-discuss > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of ENet-discuss digest..." > > > Today's Topics: > > 1. Finding LAN server IP address (Jonathan Hodgkinson) > 2. Re: Finding LAN server IP address (William Brandt) > 3. Re: Finding LAN server IP address (Emmanuel Astier) > 4. Re: Finding LAN server IP address (Peter Soxberger) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 13 Aug 2009 22:52:45 +0100 > From: Jonathan Hodgkinson <[email protected]> > To: [email protected] > Subject: [ENet-discuss] Finding LAN server IP address > Message-ID: > <[email protected]> > Content-Type: text/plain; charset="iso-8859-1" > > 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! > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.cubik.org/pipermail/enet-discuss/attachments/20090813/e7be659c/attachment.html > > > > ------------------------------ > > Message: 2 > Date: Fri, 14 Aug 2009 03:14:32 -0500 > From: William Brandt <[email protected]> > To: Discussion of the ENet library <[email protected]> > Subject: Re: [ENet-discuss] Finding LAN server IP address > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii" > > An HTML attachment was scrubbed... > URL: < > http://lists.cubik.org/pipermail/enet-discuss/attachments/20090814/44f1d41d/attachment-0001.htm > > > > ------------------------------ > > Message: 3 > Date: Fri, 14 Aug 2009 10:58:33 +0200 > From: "Emmanuel Astier" <[email protected]> > To: "Discussion of the ENet library" <[email protected]> > Subject: Re: [ENet-discuss] Finding LAN server IP address > Message-ID: > <[email protected]> > Content-Type: text/plain; charset="iso-8859-1" > > 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. > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.cubik.org/pipermail/enet-discuss/attachments/20090814/aeeed4fa/attachment-0001.htm > > > > ------------------------------ > > Message: 4 > Date: Fri, 14 Aug 2009 13:35:21 +0200 > From: "Peter Soxberger" <[email protected]> > To: Discussion of the ENet library <[email protected]> > Subject: Re: [ENet-discuss] Finding LAN server IP address > Message-ID: <[email protected]> > Content-Type: text/plain; charset="iso-8859-1" > > 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" <[email protected]> > > An: "Discussion of the ENet library" <[email protected]> > > 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 : [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. > > > > -- > GRATIS f?r alle GMX-Mitglieder: Die maxdome Movie-FLAT! > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 > > > ------------------------------ > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > > > End of ENet-discuss Digest, Vol 75, Issue 5 > ******************************************* >
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
