<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Long Cheng,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">that's what they also suggested me on IRC.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">If I got it straight, those calls - enet_host_service() and enet_host_check_events()</div><div class="gmail_default" style="font-family:tahoma,sans-serif">only watch if there are messages already buffered and do not touch the socket, so they are very fast.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks a lot!</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Ricky</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 21, 2016 at 4:29 PM, Long Cheng <span dir="ltr"><<a href="mailto:long.x.cheng@gmail.com" target="_blank">long.x.cheng@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<p>sorry for the typo, correct:<br>
</p>
<p><span class=""> int er = enet_host_service(host, &event, timeout);<br>
while (er > 0)<br>
{<br>
// process event<br></span>
er = enet_host_check_events(host, &event);<br>
}</p><div><div class="h5">
<br>
<div>在 2016/9/21 22:27, Long Cheng 写道:<br>
</div>
<blockquote type="cite">
<p>you should handle multiple events in one frame like this:</p>
<p> int er = enet_host_service(host, &event, timeout);<br>
while (er > 0)<br>
{<br>
// process event<br>
er = enet_host_check_events(enet_<wbr>server, &event);<br>
}<br>
</p>
<p><br>
</p>
<br>
<div>在 2016/9/21 19:17, Riccardo Corsi 写道:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-family:tahoma,sans-serif">Hi all,</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif">
<div class="gmail_default">I'd like to implement a
single-threaded polling schema, calling
enet_host_service() every game frame as suggested in the
tutorial.</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">Now, enet_host_service() returns
a single event (if any), </div>
<div class="gmail_default">so what is the correct way to
handle the case in which I have received multiple events
between 2 consecutive frames?</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">I was thinking to call every
frame something like:</div>
<div class="gmail_default">while (enet_host_service (client,
& event, 0U) > 0)<br>
</div>
<div class="gmail_default">{ ... }</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">but I wonder whether this might
stall the application. </div>
<div class="gmail_default">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?</div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">Thank you,</div>
<div class="gmail_default">Ricky</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>______________________________<wbr>_________________
ENet-discuss mailing list
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/<wbr>mailman/listinfo/enet-discuss</a>
</pre>
</blockquote>
<br>
</blockquote>
<br>
</div></div></div>
<br>______________________________<wbr>_________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" rel="noreferrer" target="_blank">http://lists.cubik.org/<wbr>mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br></div>