<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:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Comic Sans MS";
        panose-1:3 15 7 2 3 3 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.preprocessor
        {mso-style-name:preprocessor;}
span.keywordtype
        {mso-style-name:keywordtype;}
span.comment
        {mso-style-name:comment;}
span.keywordflow
        {mso-style-name:keywordflow;}
span.stringliteral
        {mso-style-name:stringliteral;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</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 style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=WordSection1>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'>FYI: be careful with the MAC address you choose.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Any MAC address with the <u>0x01</u> bit on in the <u>first byte</u>
is considered an <i><u>all-stations</u></i><u> <i>broadcast</i></u><i>.</i><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Is that what you actually intended to do? &nbsp;Send 10,000
packets to ALL/every network adapter on your local network?? &nbsp;(if your
host has more than one network adapter on the same physical network segment
then they&#8217;ll <i>both</i> receive every packet.)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'>If you need a MAC address to test with, the IANNA has reserved the
range 00-00-5E-00-00-00 through 00-00-5E-FF-FF-FF just for that purpose.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'>See the section &#8220;IANA ETHERNET ADDRESS BLOCK - UNICAST USE&#8221;
(about 0.75 of the way down the web page) in the following document:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-indent:.5in'><span style='font-size:10.5pt;
font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;<a
href="http://www.iana.org/assignments/ethernet-numbers">http://www.iana.org/assignments/ethernet-numbers</a><o:p></o:p></span></p>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='font-size:7.5pt;font-family:"Arial","sans-serif";color:black'>-- </span><span
style='color:#1F497D'><br>
</span><span style='font-size:13.5pt;font-family:"Arial","sans-serif";
color:black'>&nbsp; &quot;</span><b><span style='font-family:"Arial","sans-serif";
color:green'>Fish</span></b><span style='font-size:13.5pt;font-family:"Arial","sans-serif";
color:black'>&quot;</span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>&nbsp; (</span><span style='font-size:10.0pt;font-family:"Comic Sans MS";
color:purple'>David B. Trout</span><span style='font-size:10.0pt;font-family:
"Arial","sans-serif";color:#1F497D'>)</span><span style='color:#1F497D'> <br>
</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>&nbsp;&nbsp;</span><span style='color:#1F497D'>&nbsp; </span><u><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>fish@softdevlabs.com</span></u><span
style='color:#1F497D'><o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></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;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
winpcap-users-bounces@winpcap.org [mailto:winpcap-users-bounces@winpcap.org] <b>On
Behalf Of </b>Alimjan Kuramshin<br>
<b>Sent:</b> Saturday, September 18, 2010 2:33 PM<br>
<b>To:</b> winpcap-users@winpcap.org<br>
<b>Subject:</b> [Winpcap-users] WinPCAP packets capture delay..<br>
<b>Importance:</b> High<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Hello!<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>Gianluca, can u run this code on Your machine and running
the Wireshark save the log and send it to me, please..<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>Is there any delays, i mean delays between the packets that
Wireshark (winpcap) capture?<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>P.S. code from WinPcap documentation, sending packets, not
one, but 10000 (or 1000000)..<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div><pre><span class=preprocessor>#include &lt;stdlib.h&gt;</span><o:p></o:p></pre><pre><span
class=preprocessor>#include &lt;stdio.h&gt;</span><o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=preprocessor>#include &lt;pcap.h&gt;</span><o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=keywordtype>void</span> main(<span class=keywordtype>int</span> argc, <span
class=keywordtype>char</span> **argv)<o:p></o:p></pre><pre>{<o:p></o:p></pre><pre><a
href="http://www.winpcap.org/docs/docs_412/html/group__wpcap__def.html#ga4711d025f83503ce692efa5e45ec60a7"
title="Descriptor of an open capture instance. This structure is opaque to the user, that...">pcap_t</a> *fp;<o:p></o:p></pre><pre><span
class=keywordtype>char</span> errbuf[<a
href="http://www.winpcap.org/docs/docs_412/html/group__wpcap__def.html#gacd448353957d92c98fccc29e1fc8d927"
title="Size to use when allocating the buffer that contains the libpcap errors.">PCAP_ERRBUF_SIZE</a>];<o:p></o:p></pre><pre>u_char packet[100];<o:p></o:p></pre><pre><span
class=keywordtype>int</span> i;<o:p></o:p></pre><pre>volatile int n_pkts = 10000; // 1000000<o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=comment>/* Check the validity of the command line */</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=keywordflow>if</span> (argc != 2)<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; {<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(<span
class=stringliteral>&quot;usage: %s interface (e.g. 'rpcap://eth0')&quot;</span>, argv[0]);<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=keywordflow>return</span>;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; }<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;<span
class=comment>/* Open the output device */</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=keywordflow>if</span> ( (fp= <a
href="http://www.winpcap.org/docs/docs_412/html/group__wpcapfunc.html#ga2b64c7b6490090d1d37088794f1f1791"
title="Open a generic source in order to capture / send (WinPcap only) traffic.">pcap_open</a>(argv[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=comment>// name of the device</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 65536,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
class=comment>// portion of the packet to capture (only the first 100 bytes)</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a
href="http://www.winpcap.org/docs/docs_412/html/group__remote__open__flags.html#ga9134ce51a9a6a7d497c3dee5affdc3b9"
title="Defines if the adapter has to go in promiscuous mode.">PCAP_OPENFLAG_PROMISCUOUS</a>,&nbsp; <span
class=comment>// promiscuous mode</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1000,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=comment>// read timeout</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=comment>// authentication on the remote machine</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errbuf&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
class=comment>// error buffer</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ) == NULL)<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; {<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(stderr,<span
class=stringliteral>&quot;\nUnable to open the adapter. %s is not supported by WinPcap\n&quot;</span>, argv[1]);<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=keywordflow>return</span>;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; }<o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=comment>/* Supposing to be on ethernet, set mac destination to 1:1:1:1:1:1 */</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[0]=1;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[1]=1;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[2]=1;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[3]=1;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[4]=1;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[5]=1;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;<span
class=comment>/* set mac source to 2:2:2:2:2:2 */</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[6]=2;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[7]=2;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[8]=2;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[9]=2;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[10]=2;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; packet[11]=2;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;<span
class=comment>/* Fill the rest of the packet */</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=keywordflow>for</span>(i=12;i&lt;100;i++)<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; {<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; packet[i]=(u_char)i;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; }<o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre>&nbsp;&nbsp;&nbsp; while (n_pkts--)<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=comment>/* Send down the packet */</span><o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=keywordflow>if</span> (<a
href="http://www.winpcap.org/docs/docs_412/html/group__wpcapfunc.html#ga51dbda0f1ab9da2cfe49d657486d50b2"
title="Send a raw packet.">pcap_sendpacket</a>(fp, packet, 100 <span
class=comment>/* size */</span>) != 0)<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; {<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(stderr,<span
class=stringliteral>&quot;\nError sending the packet: %s\n&quot;</span>, <a
href="http://www.winpcap.org/docs/docs_412/html/group__wpcapfunc.html#ga81305cb154e4497e95bbb9b708631a3a"
title="return the error text pertaining to the last pcap library error.">pcap_geterr</a>(fp));<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
class=keywordflow>return</span>;<o:p></o:p></pre><pre>&nbsp;&nbsp;&nbsp; }<o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre>&nbsp;&nbsp;&nbsp; <span
class=keywordflow>return</span>;<o:p></o:p></pre><pre>}<o:p></o:p></pre><pre>/* EOF */<o:p></o:p></pre><pre>Thanks, bye..<o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</div>

</div>

</body>

</html>