Hi Long Cheng,

that's what they also suggested me on IRC.

If I got it straight, those calls - enet_host_service()
and enet_host_check_events()
only watch if there are messages already buffered and do not touch the
socket, so they are very fast.

Thanks a lot!

Ricky

On Wed, Sep 21, 2016 at 4:29 PM, Long Cheng <long.x.ch...@gmail.com> wrote:

> sorry for the typo, correct:
>
>     int er = enet_host_service(host, &event, timeout);
>     while (er > 0)
>     {
>         // process event
>         er = enet_host_check_events(host, &event);
>     }
>
> 在 2016/9/21 22:27, Long Cheng 写道:
>
> you should handle multiple events in one frame like this:
>
>     int er = enet_host_service(host, &event, timeout);
>     while (er > 0)
>     {
>         // process event
>         er = enet_host_check_events(enet_server, &event);
>     }
>
>
>
> 在 2016/9/21 19:17, Riccardo Corsi 写道:
>
> Hi all,
>
> I'd like to implement a single-threaded polling schema, calling
> enet_host_service() every game frame as suggested in the tutorial.
>
> Now, enet_host_service() returns a single event (if any),
> so what is the correct way to handle the case in which I have received
> multiple events between 2 consecutive frames?
>
> I was thinking to call every frame something like:
> while (enet_host_service (client, & event, 0U) > 0)
> { ... }
>
> but I wonder whether this might stall the application.
> Or I can make the assumption that enet_host_service() is fast enough to
> return with timeout 0 that it's impossible to have it stalling in the loop?
>
> Thank you,
> Ricky
>
>
> _______________________________________________
> ENet-discuss mailing 
> listENet-discuss@cubik.orghttp://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
>
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss@cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
_______________________________________________
ENet-discuss mailing list
ENet-discuss@cubik.org
http://lists.cubik.org/mailman/listinfo/enet-discuss

Reply via email to