Go Premium for a chance to win a PS4. Enter to Win


upd does not get disordered

Posted on 2000-02-21
Medium Priority
Last Modified: 2010-03-18
I am sending udp packets to the port 7
of a remote host and the packets are returned in the same order they were
Could you send to me a code in C with
2 threads (sender and receiver)in wich
the packets get disordered?

Question by:jjescri
  • 2

Expert Comment

ID: 2545426
Well, it looks to me that UDP does not *guarantee* that packets will be received in the order they are sent. But it does not guarantee the opposite either.

This means you cannot rely on the packet (dis)ordering either way. (As a matter of fact you cannot even assume that packets are actually delivered, unless somehow acknowledged)

The reasons packets (TCP or UDP) can get out of order are plentiful but they are dependent on the network paths and conditions, not on their specific treatment at the sending/receiving side. (For instance packets can be processed by different routers and travel through different network segments).
In my opinion, you will seldom (if ever) witness such an occurence on your standard LAN.

UDP differs from TCP in that while a conscious effort is made to reorder out-of-order TCP packets (using sequence numbers) no such action is taken for UDP. OTOH no effort is made to scramble UDP packet ordering, either.

HTH & cheers,

Expert Comment

ID: 2546011
What alf told is correct.
That basically depends on where your server and client are located in LAN. I think your LAN could be small and you may have few paths from server to client. More over there really may not be much delay in two paths. That is why you are receiving the packets in the same order.
try to put your client and server in a big LAN where many paths exists and network trafic is more, then you will see the dis order of the packets.
Bt I have seen many times dis order of packets.

Author Comment

ID: 2546198
My server in Spain (Europe) and my client is in USA.

Accepted Solution

alien_life_form earned 200 total points
ID: 2546281

This does in no way guarantee that your
packets do in fact take different  network paths. It is in fact extremely
likely that (during the same session) the path taken by your packets do not change. (Try traceroute at a few seconds interval  - does the sequence of gateways change?)

I may be mistaken, but in the IP world, the only way for a (short) session (of course UDP does not have sessions, but let's assume a figure of speech) to be variably routed is that one of the routers receives a routing update which actualy changes its idea of best route while the session is in progress - this should be a rare event. Alternatively, you could be traversing a router that does dynamic load balancing during a moment of congestion, or an above-CIR frame relay segment (this would drop some of the packets).

Another (hypothetical) possibility, is if you send packets of different sizes and end up traversing a router that gives a higher priority to shorter packets (does anybody know of routers beahving this way? I'd be curious).

If nothing like this happens, and your packets travel down the cable in the order you send, then I see no way they could be scrambled. Of course, you could differently source route your packets, but, these days, everybody drops source routed packets.


Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question