Or you can create a separate host that'll constantly broadcast, like once every 3 seconds, the server's information (IP, Port, Server Name, "game ID").<br>That way the clients will get the connection information only, instead of trying to connect to a broadcasting host.<br>
<br><div class="gmail_quote">On Sat, Aug 15, 2009 at 1:21 AM, <span dir="ltr"><<a href="mailto:dean.enet@codeka.com">dean.enet@codeka.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">> Thanks for the replies. I do seem to have had some success<br>
> with setting the server with:<br>
><br>
> address.host = ENET_HOST_ANY;<br>
><br>
> And then the client as address.host = ENET_HOST_BROADCAST;<br>
><br>
> Once connected it seems to work fine, but it does seem flaky<br>
> to connect sometimes. I've also found that decreasing the<br>
> timeout time for the client seems to have improved matter<br>
> eg enet_host_service(sClient, &event, 100) (from like 5000).<br>
<br>
</div>I'm not sure it's really a good idea to be using ENet to do broadcasts. The<br>
problem is if there happens to be two hosts on the local network listening<br>
on the same port, they're *both* going to get the connection request and<br>
that's obviously going to confuse the client. Even if you establish a<br>
connection to one host, if another one comes up while you're still talking<br>
to the first, it's going to be confused as well, since it'll think you're<br>
talking to it.<br>
<br>
I think the best solution is as Emmanuel said: you just do a single packet<br>
broadcast (using normal sockets, not ENet) "are there any servers?" then the<br>
servers can respond (with a broadcast of their own) "I am at IP w.x.y.z".<br>
Then you can do a normal ENet connection to w.x.y.z. That way you don't have<br>
to worry about multiple servers being on the local network or anything like<br>
that.<br>
<br>
Dean.<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
</div></div></blockquote></div><br>