[ENet-discuss] How can I set the timeouts?

Bjørn Lindeijer bjorn at lindeijer.nl
Sat Oct 25 03:40:30 PDT 2008


On 10/24/08, Peter Soxberger <Peter.Soxberger at gmx.net> wrote:
> Hi!
>
>  I wanted to know how I can set the event timeouts (disconnect event(s))?
>
>  And 2 other small questions:
>  -Do I need to use enet_packet_destroy or do they destroy on there own after some time? Because in the tutorial enet_packet_destroy is not used...

Indeed, it's not used in the tutorial and the text reads "A packet is
sent to a foreign host with enet_peer_send(). enet_peer_send() accepts
a channel id over which to send the packet to a given peer. Once the
packet is handed over to ENet with enet_peer_send(), ENet will handle
its deallocation and enet_packet_destroy() should not be used upon
it."

Though in my opinion this should also be noted in the API docs of
enet_peer_send, not just in the tutorial. In makes sense though, since
otherwise ENet would have to make a copy of the packet since it isn't
sent synchronously.

>  -I want that the client disconnects immediately after using the disconnect function but also want that the disconnect event will be called immediately (no timeout). Which disconnect function should I use?

Hmm, I don't know the answer to this one. I think at least you'll have
to wait on the disconnect to be sent away, preferably even waiting
until you know the other side got it.

Regards,
Bjørn


More information about the ENet-discuss mailing list