[ENet-discuss] any news on enet_peer_send()?

eye at dihalt.com eye at dihalt.com
Thu Mar 20 14:05:01 PDT 2008


Hello. I'm terrible sorry for asking again: no one has
replayed on my previous message, but it was like a
conversation to me ^_^'

I tested the code. There is a little problem:
peer->windowsSize is a constant value of
ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE (32768) if network speed
is not set. And i can't set or test network speed for
end-user programs - speed can be very different each
minute. 32768 is a big value. On slow GPRS networks and
medium size packets (~1k) sending 32768/1024 = 32 packets
will surely lead to ACK timeout :(.

So a code:

for(; ::enet_host_service(poHost, &oEvent, 0) >= 0);)
{
  if(poPeer->reliableDataInTransit + 1124 >
     peer -> windowSize) continue;

  ENetPacket *poPacket = ::enet_packet_create(pbData,
    ENET_PACKET_FLAG_RELIABLE);
  _ASSERT(poPacket);
  _VERIFY(0 == ::enet_peer_send(poPeer, 0, poPacket));
}

will disconnect by ACK timeouts (protocol.cpp, line 1172)
in half of test cases :(. Is it any way to prevent
disconnections but don't use a
send-packet-wait-ack-send-next slow pattern?

On Sun, 16 Mar 2008 19:19:05 -0700
 Lee Salzman <lsalzman1 at cox.net> wrote:
> Use something like:
> 
>   if (peer -> reliableDataInTransit +
> size_of_packet_you_wish_to_send + 
> 100 < peer -> windowSize)
>      ...
> 
> where that "100" value is just a margin/fudge value to
> account for 
> packet headers and such.
> 
> Lee


More information about the ENet-discuss mailing list