Solved

upd does not get disordered

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

Thanks
0
Comment
Question by:jjescri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:alien_life_form
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,
   alf
0
 
LVL 3

Expert Comment

by:sreenathk
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.
Sreenath
0
 

Author Comment

by:jjescri
ID: 2546198
My server in Spain (Europe) and my client is in USA.
0
 
LVL 3

Accepted Solution

by:
alien_life_form earned 100 total points
ID: 2546281
Greetings.

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.

Cheers,
  alf
0

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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