<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Arial","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Hello,&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>I am trying
to send packets using the pcap_sendqueue_transmit( adapter, queue, 1) &nbsp;// <b>sync
mode == true<o:p></o:p></b></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>I see that
the larger the queue , the higher the actual transmission rate. <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>My guess is
that the usage is wrong. <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Pseudo code:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Transmit(buff){<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If(available_room
&lt; 2000){<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pcap_sendqueue_transmit(adapter,
queue,1);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'><span
style='font-family:"Arial","sans-serif"'>// force reallocation since the queue
is NOT emptied by the transmission ?!<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'><span
style='font-family:"Arial","sans-serif"'>pcap_sendqueue_destroy(queue);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'><span
style='font-family:"Arial","sans-serif"'>queue = pcap_sendqueue_alloc(queue_size);<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'><span
style='font-family:"Arial","sans-serif"'>available_room = queue_size;<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-family:"Arial","sans-serif"'>}<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-family:"Arial","sans-serif"'>pcap_sendqueue_queue(queue,
header, buff);<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-family:"Arial","sans-serif"'>available_room
-= buff_size + 16;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>OS: Win XP
SP3<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Winpcap 4.1.1
(latest from 2009-10-25)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>When I ran
with queue_size = 20000 I saw the rate is about 2% faster than required. I
tested by capturing the transmitted packet with wireshark (tried on the same
and different machine with same results), and comparing the captured file with
the original pcap file that was fed to the above code.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Is the
transmission done in kernel? I thought saw until today when I read the sources
(packet.dll) and now I am not sure.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Any ideas?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Thanks<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Noam Cohen<o:p></o:p></span></p>

</div>

</body>

</html>