<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body fPStyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<p>I've been trying to tell you that UDP does NOT guarantee ordering.  And guess what you found...it's out of order.</p>
<p>It also doesn't guarantee delivery.  Your lucky you're not dropping packets...if you overrun the IP queue you would be dropping them.  You shouldb be using TCP.  Or...you need a sequence number in the packet so you can reassemble the order yourself.</p>
<p> </p>
<p>That's why its nickname is "Unreliable Datagram Protocol".</p>
<p><a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol">http://en.wikipedia.org/wiki/User_Datagram_Protocol</a></p>
<p> </p>
<p>You're probably seeing multi-core processing of packets...so it can pick them out of order since it doesn't violate the protocol.</p>
<p> </p>
<p><a href="http://stackoverflow.com/questions/2533873/why-do-i-get-udp-datagrams-out-of-order-even-with-processes-runnning-locally">http://stackoverflow.com/questions/2533873/why-do-i-get-udp-datagrams-out-of-order-even-with-processes-runnning-locally</a></p>
<div>
<p> </p>
<div style="FONT-FAMILY: Tahoma; FONT-SIZE: 13px">
<p>Michael D. Black</p>
<p>Senior Scientist</p>
<p>NG Information Systems</p>
<p>Advanced Analytics Directorate</p>
<p> </p>
</div>
</div>
<div style="FONT-FAMILY: Times New Roman; COLOR: #000000; FONT-SIZE: 16px">
<hr tabindex="-1">
<div style="DIRECTION: ltr" id="divRpF755259"><font color="#000000" size="2" face="Tahoma"><b>From:</b> winpcap-users-bounces@winpcap.org [winpcap-users-bounces@winpcap.org] on behalf of neil.powell neil.powell [neil.powell@HERRHAIR.COM]<br>
<b>Sent:</b> Friday, February 25, 2011 2:44 AM<br>
<b>To:</b> winpcap-users@winpcap.org<br>
<b>Cc:</b> neil.powell neil.powell<br>
<b>Subject:</b> EXT :[Winpcap-users] WinPCAP Packet ordering<br>
</font><br>
</div>
<div></div>
<div>
<p style="MARGIN: 0px">Hello,<br>
   <br>
I would like to ask a question to the mailing list; I apologise if this has been<br>
answered before I did search the archive but didn't see anything relating to my<br>
question.<br>
   <br>
Firstly let me explain what I am trying to achieve...<br>
   <br>
   <br>
I am writing a Windows application that is targeting Windows 7 64bit<br>
multiprocessor machines.  The basic idea is as follows....  I have a piece of<br>
hardware (FPGA based) that is delivering layer II packets over a Gbit network;<br>
each packet is NO more than 1500 bytes.  The data rate pushed out of the FPGA is<br>
typically 50Mbytes per sec or lower.<br>
   <br>
The purpose of the Windows application is the capture each packet off the<br>
network, do some quick data integrity checks on the payload and dump it to disk<br>
ASAP.  The FPGA has a 12bit packet counter (0-4095); this count is placed inside<br>
our bespoke payload so that the data can be reconstituted on the PC. During the<br>
data integrity checks I check the packet count to ensure the packets are in<br>
order before I begin reconstituting the data; I also sanity check the timestamp<br>
of each packet to make sure it too is increasing.<br>
   <br>
   <br>
 Here is my question/problem.....<br>
 On multicore 64 bit machines (with a 64 bit OS) can the packets come out of<br>
order?<br>
 My justification for the question is as follows. During debug of the windows<br>
application I report the timestamp and pkt number of each packet.  Whilst it<br>
appears that I do not drop packets I do see packets numbers come out of order. <br>
Here is a debug trace.<br>
 <br>
   Timestamp             Pkt #<br>
   15:38:40:415412   2222<br>
   15:38:40:415413   2223<br>
   15:38:40:415424   2224<br>
   15:38:40:415425   2225<br>
   15:38:40:415426   2226<br>
   15:38:40:415428   2227<br>
   15:38:40:415428   Found Packet: 2236 Expecting Packet: 2228<br>
   15:38:40:415430   2237<br>
   15:38:40:415431   2238<br>
   15:38:40:415433   2239<br>
   15:38:40:415433   Found Packet: 2228 Expecting Packet: 2240<br>
   15:38:40:415434   2229<br>
   15:38:40:415445   2230<br>
   15:38:40:415447   2231<br>
   15:38:40:415447   2232<br>
   15:38:40:415448   2233<br>
   15:38:40:415451   2234<br>
   15:38:40:415452   2235<br>
   15:38:40:415453   Found Packet: 2240 Expecting Packet: 2236<br>
   15:38:40:415454   2241<br>
   15:38:40:415456   2242<br>
   15:38:40:415457   2243<br>
   15:38:40:415467   2244<br>
   15:38:40:415469   2245<br>
   15:38:40:415471   2246<br>
   <br>
If you follow the trace you can see that I don't drop packets but they are<br>
indeed out of order.  <br>
I must stress that this situation is NOT frequent but is exacerbated by high<br>
data rates or heavy disk usage.<br>
I have spent some time eliminating all the obvious… debug output buffering, <br>
FPGA output and disk writes all of which have drawn a blank.<br>
 <br>
I am using WinPCAP in the following manner:<br>
 <br>
pcap_open:<br>
snaplen = 1500;<br>
flags =<br>
PCAP_OPENFLAG_PROMISCUOUS|PCAP_OPENFLAG_NOCAPTURE_LOCAL|PCAP_OPENFLAG_MAX_RESPONSIVENESS;<br>
read_timeout = 0;<br>
 <br>
pcap_setbuff:<br>
100Mb<br>
 <br>
pcap_setmintocopy:<br>
0<br>
 <br>
 <br>
Thank you in advance<br>
 <br>
 <br>
 <br>
Neil Powell</p>
</div>
</div>
</div>
</body>
</html>