[ENet-discuss] totally flush the outgoing commands list

Lee Salzman lsalzman at gmail.com
Wed Sep 11 04:06:26 PDT 2013


Mainly theoretical, but it can keep the host from being overwhelmed by a constant stream of socket traffic since it ensures that it's all done upfront. It just gives a bit stricter guarantee about when certain things are done each frame.

On 09/11/2013 01:51 PM, Thorbjørn Lindeijer wrote:
> On Wed, Sep 11, 2013 at 12:28 PM, Lee Salzman <lsalzman at gmail.com> wrote:
>> There is a function enet_host_check_events() designed to work around this
>> problem - it just returns events from the event queue and instead of hitting
>> the socket when the event queue is empty, it just does nothing. So assuming
>> you start with an empty event queue on each frame, first you call
>> enet_host_service() which will do its thing to the socket, and then
>> continually call enet_host_check_events() till there are no more events
>> left.
> Hmm, are you saying that it would be a good idea not to keep hitting
> the socket? At the moment I'm doing like in the tutorial, but every
> 100 ms:
>
> while (enet_host_service(mHost, &event, 0) > 0) {
>
> And what you are suggesting would be to change that to:
>
> enet_host_service(mHost, 0, 0);
> while (enet_host_check_events(mHost, &event) > 0) {
>
> But I guess it doesn't matter much? I wonder a little if there was
> maybe some other purpose of this separation.
>
> Regards,
> Bjørn


More information about the ENet-discuss mailing list