# TCP/IP Packets Arriving Out of Order

**URL:** <https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204>\
**Category:** Factual Questions\
**Created:** [September 25, 2008, 7:38pm UTC](https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204 "2008-09-25T19:38:50Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![HMS\_Irruncible](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hms_irruncible/32/7394_2.png) [@HMS\_Irruncible](https://boards.straightdope.com/u/HMS_Irruncible)\
**Post date:** [September 26, 2008, 12:23am UTC](https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204/21 "2008-09-26T00:23:33Z")

</div>

> [@Mr.Slant](#):
>
> Sysadmindopers:  
> Is there any precedent for a situation I’m running into where packets arrive in substantially the wrong order?
> 
> I’ve got a packet A sent at:  
> 10:10:10  
> Then I’ve got a packet B sent at 10:11:20.  
> These times per Server 1.
> 
> We’re seeing packet B showing up at Server 2, then 10 seconds later packet A shows up at Server 2.
> 
> Let me know. This is bizarre.

I’ve seen weird stuff like this happen a few times, and each time it was due to asymmetric routing… either there were dual network cards, or one of the hosts was configured to reply through a different pathway than they received the packets. Get your network admin to put a sniffer on both ends and see where the routing tables are boned up.

---

<div class="post-metadata">

**Author:** ![erislover](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@erislover](https://boards.straightdope.com/u/erislover)\
**Post date:** [September 26, 2008, 1:24am UTC](https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204/22 "2008-09-26T01:24:19Z")

</div>

> [@Mr.Slant](#):
>
> I believe what I’m hearing is that TCP/IP does occasionally deliver packets out of order.

Application wraps data up to send out a TCP/IP port. The data is put into a TCP packet. The TCP packet is wrapped into an IP packet. IP does not guarantee orderly arrival. IP does not guarantee arrival at all. But magically, TCP does guarantee orderly presentation to the application layer.

[joelonsoftware](http://www.joelonsoftware.com/printerFriendly/articles/LeakyAbstractions.html) has a lecture-y article that talks about TCP which may help.

---

<div class="post-metadata">

**Author:** ![ed](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@ed](https://boards.straightdope.com/u/ed)\
**Post date:** [September 26, 2008, 2:19am UTC](https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204/23 "2008-09-26T02:19:24Z")

</div>

As has been said, if you’re using TCP and the segments arrive out of order, the worst that can happen is that you’ll get a RST and the connection will terminate. Under no circumstances would the network driver actually hand over a reordered data stream, that would be completely terrible.

If you’re not using TCP, and using UDP, then you can certainly get them out of order. That’s why you shouldn’t use UDP. 🙂

Also, programmers blaming the network without so much as a network trace to back them up really grinds my gears (no offense meant to the OP). Honestly, it’s almost never a network problem. Fire up wireshark and see what’s really going on.

---

<div class="post-metadata">

**Author:** ![DanBlather](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@DanBlather](https://boards.straightdope.com/u/DanBlather)\
**Post date:** [September 26, 2008, 3:47am UTC](https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204/24 "2008-09-26T03:47:32Z")

</div>

> [@friedo](#):
>
> One of the specific design goals of TCP/IP is to allow packets to arrive out of order and then be reassembled correctly. I’d be more concerned about why it takes you a minute and 20 seconds to send all of two packets in the first place.

That is not correct. TCP/IP can not re-asemble packets that arrive out of order. What it does is discard packets that arrive out of order. The protocol will cause the packets to be re-sent. This is one of the weaknesses of TCP/IP.  
ETA: this is all occurring below the application layer of course.

[Previous page](https://boards.straightdope.com/t/tcp-ip-packets-arriving-out-of-order/465204.md?page=1)
