[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Networking

Arghya Das wrote:
> wondering if UDP protocol doesn't have any mechanism of error contol like
> TCP and no ordering of data packets

No.  UDP is an unreliable datagram protocol.  Adding reliability is up
to the application *if* the application desires or needs it.

> then how does VOIP calls work..?

The application handles it, not the kernel.

> i mean if a sender sends a message over skype then the receiver can
> receive the message scrambled or a partial message cause there is no
> way of ordering of packets or error checking of packets and some
> packets might also get lost during transmission.

Yes.  That all correct.

> But that doesn't happen,

The packets *do* get scrambled, lost, duplicated.  If you were
observing the network data you would see this.  The application
program doesn't show that to you.  You are observing the program.  The
program handles it internally.  You are only seeing the external
program behavior.

> so what is the logic behind this..?
> does anyone have an answer...?

If the application needs it then it creates its own protocol layer on
top of UDP and adds it.  This is the advantage of UDP.  With TCP all
of that overhead is added by the kernel.  An application cannot remove
the overhead.  If an application needs something in between UDP an TCP
then it can't remove overhead from TCP but it can add what it needs to
UDP.  For time urgent data transmission such as VOIP or games or many
other things the sender "sprays" packets continuously at the
receiver.  If some packets are lost in the middle the receiver does
not want to wait for them to arrive.  A voip call will accept losing
packets in the middle in order to keep up with the data stream.

Typically an application will add a packet serial number counter to
the data being sent over UDP.  Every packet sent will have an
incremented value.  Upon receiving the packets the application will
check the serial number count.  Typically it might read packets that
are later than any previously read packet.  Typically it might discard
any packet with a serial number count less than or equal to any
previously read packet.  This provides for the application to always
read forward in time.  All duplicates will be discarded.  Some late
arriving packets will be lost.  For something like VOIP that is mostly
acceptable quality loss.  You might never hear it on a reasonably good


Attachment: signature.asc
Description: Digital signature

Reply to: