[ENet-discuss] enet_host_connect using a broadcast address
LoneSock
lonesock at gmail.com
Wed Mar 2 12:40:44 PST 2005
Hi, all.
I was trying to connect to any available server on my subnet, using a
broadcast address (192.168.1.255). The server sees the connection
request and seems to respond (as the state of that peer (on the
server) goes to ENET_PEER_STATE_ACKNOWLEDGING_CONNECT). However the
client seems to throw out the ack, because it just hangs there. I
suspect that it is dismissing the ack in the following line:
(in protocol.c, enet_protocol_handle_incoming_commands)
if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||
peer -> state == ENET_PEER_STATE_ZOMBIE ||
host -> receivedAddress.host != peer -> address.host ||
header -> challenge != peer -> challenge)
return 0;
because I requested a connection to a broadcast address, and received
the reply from the server's actual address (which differs, of course).
The way I work around it is by detecting a soft time-out on the server
side (i.e. is a peer state stays at
ENET_PEER_STATE_ACKNOWLEDGING_CONNECT for too long), and then trying
to start the connection from the server side. This works, but I have
to set PeerCount to 2 in enet_host_create on the client, and it's kind
of ugly.
Is there a better way to do this? Should I hack ENet so there is a
"broadcasting" flag, and it just checks the challenge and port numbers
in the case of a broadcast connect? Is anybody else interrested in
this, or is it just me.
By the way, I'm loving ENet.
Jonathan
--
Piranha are people too.
More information about the ENet-discuss
mailing list