Great thanks, I'll try to play with npackets.<br><br><div class="gmail_quote">2011/4/8 Mark Pizzolato - WinPCap-Users <span dir="ltr"><<a href="mailto:winpcap-users-20040408@subscriptions.pizzolato.net">winpcap-users-20040408@subscriptions.pizzolato.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">If you want to send them precisely evenly spaced, then you have to do what your pseudo code suggests and suffer the consequences.  You may find that achieving fine grained delay and high packets rates could be hard.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Meanwhile, if you realize that there will be buffering in various places no matter what you do, you might get the same results with much lower overhead by sending a series of short bursts of n packets and delay between the bursts:</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">While (true) {</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Pcap_sendqueue_transmit (npackets);</span></p><p class="MsoNormal">
<span style="font-size:11.0pt;color:#1F497D">Delay (…);</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">}</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">When n is 2 or greater the kernel transitions will be reduced accordingly. The right choice for n will likely depend on link speed, packet size, and receive buffer capacity of the where you are sending to.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">winpcap-users-bounces@winpcap.org</a> [mailto:<a href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">winpcap-users-bounces@winpcap.org</a>] <b>On Behalf Of </b>?????? ???????<br>
<b>Sent:</b> Friday, April 08, 2011 5:47 AM<br><b>To:</b> <a href="mailto:winpcap-users@winpcap.org" target="_blank">winpcap-users@winpcap.org</a><br><b>Subject:</b> [Winpcap-users] Efficient sending huge number of UDP packets at afixed specified rate</span></p>
</div></div><div><div></div><div class="h5"><p class="MsoNormal"> </p><p class="MsoNormal">Good day, colleagues!<br><br>Do you know efficient way of sending UDP packets at a fixed rate efficiently?<br><br>As far as I know, there are 2 functions for packets sending - pcap_sendpacket and pcap_sendqueue_transmit. Regarding the first, it's easy to realize this pseudocode:<br>
<br>while (true) {<br>pcap_send_packet(...);<br>delay (...);<br>}<br><br>But, as said in WinPcap tutorial, pcap_send_packet is inefficient if you need high performance (and I need it).<br><br>pcap_sendqueue_transmit is optimized efficient way to send packets, but as I can see, there is no way to specify sending rate in pcap_sendqueue_transmit, i. e. pcap_sendqueue_transmit will send packets as fast as possible which is not suitable in my situation.<br>
<br>Can you give any recommendations?<br clear="all"><br>-- <br>Best regards, Metcherin Sergey.</p></div></div></div></div></div><br>_______________________________________________<br>
Winpcap-users mailing list<br>
<a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
<a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Best regards, Metcherin Sergey.<br>