<font size="2">
<div>Another aproximation: Connecting broadcast</div>
<div> </div>
<div>We can connect to a ENET_HOST_BROADCAST host so any Server will reply our connect Request. Then we do all the server data information interchange and disconnect from it.</div>
<p>Repeating this proccess we could obtain information from all the servers on the LAN. But there are problems with this solution. When we do a enet_host_connect, the server </p>
<p>can be the same that answered the last enet_host_connect, there are unorderer responses.</p>
<p>Does somebody know a solution for it?</p></font><br><br>
<div class="gmail_quote">2009/3/16 David Orejuela <span dir="ltr"><<a href="mailto:david.orejuela.esteban@gmail.com">david.orejuela.esteban@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><font size="2">
<p>Hi!</p>
<p>First, I'm not much experienced with enet so sorry if I'm wrong in some parts of the following discussion.</p>
<p>I've readed the following post: "How to send a broadcast message without connecting to any one?".</p>
<p>I have the same problem, a client that search servers in a LAN, wich are not registred as enet peers of a host.</p>
<p>So the default enet_host_broadcast function doesn't fit to my intentions. </p>
<p>I must send a broadcast packet through the LAN network, so I coded the following:</p>
<p> </p>
<p>int</p>
<p>enet_host_network_broadcast (ENetHost * host_origin, ENetPacket * packet)</p>
<p>{</p>
<p>ENetAddress target_address; </p>
<p>ENetBuffer buffer; </p>
<p>target_address.host = ENET_HOST_BROADCAST;</p>
<p>target_address.port = host_origin->address.port;</p>
<p>buffer.data = packet->data;</p>
<p>buffer.dataLength = sizeof(packet->data);</p>
<p></p>
<p>return enet_socket_send (host_origin->socket, &target_address, &buffer, 1);</p>
<p>}</p>
<p>In my "FindServers" client function, I use the new "enet_host_network_broadcast" enet function,</p>
<p>sending a FIND_SERVERS_REQUEST message. But this message is never read by the server.</p>
<p>Reading some posts in the mailing list I found a discussion about Multicast/Broadcast addresses (Giuseppe Greco giuseppe.greco at <a href="http://agamura.com/" target="_blank">agamura.com</a> </p>
<p>Tue Sep 4 11:09:39 PDT 2007), that talks about broadcast datagrams discarding and shows the following code</p>
<p>static int</p>
<p>enet_protocol_handle_incoming_commands (</p>
<p>ENetHost * host, ENetEvent * event)</p>
<p>{</p>
<p>...</p>
<p>if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||</p>
<p>peer -> state == ENET_PEER_STATE_ZOMBIE ||</p>
<p>(host -> receivedAddress.host != peer -> address.host &&</p>
<p>peer -> address.host != ENET_HOST_BROADCAST))</p>
<p>return 0;</p>
<p>...</p>
<p>}</p>
<p>The questions are: </p>
<p>I will be able to receive the FIND_SERVERS_REQUEST message if I modify "enet_protocol_handle_incoming_commands" removing "peer -> address.host != ENET_HOST_BROADCAST" condition?</p>
<p>Are there some kind of risks doing it?</p></font></blockquote></div><br>