[ENet-discuss] [Receive, process, send] vs. [Receive AND Send, process]

Nick Wiggill nick.wiggill at gmail.com
Wed Jul 1 04:50:13 PDT 2015


ENet seems to handle send AND receive in one strangely mangled loop when it
comes to realtime applications... not sure if this is exactly right, but
close enough:

    ENetEvent event;
    if (enet_host_service(localhost, &event, 0) > 0) //0 arg for realtime -
non-blocking
    {
         handleEvent(&event);

        int result = 0;
        if (enet_host_check_events(localhost, &event) < 0)
            printf("enet_host_check_events failed (unknown reason).\n");
        else
        {
            while (enet_host_check_events(localhost, &event) > 0)
            {
                handleEvent(&event);
            }
        }
    }

What I'd like is to receive incoming messages, do my processing based off
the incoming data, then send out a new set of messages (which feeds back
into other peers' receive cycles), *without*  pulling newly received
messages out of the enet events list, at a stage when all I want is to
*send*... I want those receives still sitting in the event queue when I
next do receiving (next frame).

enet_host_flush sadly doesn't seem to send out all the messages when I have
multiple messages queued up to the same peer, which I confirmed here -
http://lists.cubik.org/pipermail/enet-discuss/2013-September/002238.html
... so I'm forced to use enet_host_service / enet_host_check_events which
then leads to unwanted receives while I'm trying to send.

-- 
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20150701/bba9316b/attachment.html>


More information about the ENet-discuss mailing list