<div dir="ltr">enet_host_service has a built in timeout if no packets are received. By only calling it every 20ms you are introducing a fair amount of latency into the processing of the packets. What I had best luck doing is running it enet on a background thread with an incoming/outgoing queue of messages to/from the main threads with a 10ms timeout in enet_host_service, something like:<div>
<pre style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;font-size:12px;font-family:Consolas,'Liberation Mono',Courier,monospace;color:rgb(51,51,51);line-height:18px"><div class="" id="LC21" style="margin:0px;padding:0px 0px 0px 10px;border:0px">
<span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">static</span> <span class="" style="margin:0px;padding:0px;border:0px;color:rgb(68,85,136);font-weight:bold">int</span> <span class="" style="margin:0px;padding:0px;border:0px">SERVER_UPDATE_TIMER</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">10</span><span class="" style="margin:0px;padding:0px;border:0px">;</span><div>
<br></div></div></pre></div><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;font-size:12px;font-family:Consolas,'Liberation Mono',Courier,monospace;color:rgb(51,51,51);line-height:18px"><div class="" id="LC315" style="margin:0px;padding:0px 0px 0px 10px;border:0px">
<span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">while</span> <span class="" style="margin:0px;padding:0px;border:0px">(</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">!</span><span class="" style="margin:0px;padding:0px;border:0px">_serverClosed</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">&&</span> <span class="" style="margin:0px;padding:0px;border:0px">((</span><span class="" style="margin:0px;padding:0px;border:0px">result</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;border:0px">enet_host_service</span><span class="" style="margin:0px;padding:0px;border:0px">(</span><span class="" style="margin:0px;padding:0px;border:0px">_enetHost</span><span class="" style="margin:0px;padding:0px;border:0px">,</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">&</span><span class="" style="margin:0px;padding:0px;border:0px">event</span><span class="" style="margin:0px;padding:0px;border:0px">,</span> <span class="" style="margin:0px;padding:0px;border:0px">SERVER_UPDATE_TIMER</span><span class="" style="margin:0px;padding:0px;border:0px">))</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">>=</span> <span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">0</span><span class="" style="margin:0px;padding:0px;border:0px">))</span></div>
<div class="" id="LC316" style="margin:0px;padding:0px 0px 0px 10px;border:0px"> <span class="" style="margin:0px;padding:0px;border:0px">{</span><div style> // Process event<br></div><div style> ...<br>
</div>
<div style> // Process outgoing events<br></div><div style> while(outgoingQueue.getNext(outEvent))<br></div><div style> {<br></div><div style> ...<br></div><div style> }<br></div><div style>
}<br></div></div></pre></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 5:29 AM, Sebastien Robillard <span dir="ltr"><<a href="mailto:s.robillard@trio-tech.com" target="_blank">s.robillard@trio-tech.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am using enet 1.3.3 and I have an issue that might be related to enet. I am sending a reliable packet of about 3.5 mb over a local network and it takes approximately 8 seconds to receive it, which I believe should be much faster. I have a few questions on how enet handles these packets.<br>
<br>
1. Do the frequency of the call to enet_host_service (on either the sender or receiver end) matters for the time it takes to transfer the packet ?<br>
2. If so, would it change something if I call enet_host_service with a timeout ? Currently I have a timeout of 0, and move on if there are no events. enet_host_service is called every frame (~20 ms)<br>
3. Can we play with packet or buffer sizes in the enet library to improve the speed in my specific case ? I'm looking at defines like ENET_HOST_RECEIVE_BUFFER_SIZE or ENET_HOST_SEND_BUFFER_SIZE<br>
<br>
Thanks,<br>
Sebastien<br>
______________________________<u></u>_________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/<u></u>mailman/listinfo/enet-discuss</a><br>
</blockquote></div><br></div>