Saturday, 21 December 2013

UDP (User Datagram Protocol)

UDP (User Datagram Protocol

Is a simple OSI transport layer protocol for client/server network applications based on Internet Protocol (IP). UDP is the main alternative to TCP and one of the oldest network protocols in existence, introduced in 1980. It is part of the TCP/IP suite of protocols used for data transferring. UDP is a known as a "stateless" protocol, meaning it doesn't acknowledge that the packets being sent have been received. For this reason, the UDP protocol is typically used for streaming media. While you might see skips in video or hear some fuzz in audio clips, UDP transmission prevents the playback fro UDP (User Datagram Protocol)  m stopping completely.

Characteristics of the UDP protocol
The UDP protocol (User Datagram Protocol) is a connectionless orientated protocol of the transport layerof the TCP/IP model. This protocol is very simple given that it does not provide error detection (it is not connection orientated...).

The UDP segment header is therefore very simple:
Source port
(16 bits):
Destination port
(16 bits):
Total length
(16 bits)
Header checksum
(16 bits)
Data
(variable length)

Meanings of the different fields
·         Source port: this is the port number relating to the originator application of the UDP segment. This field represents a response address for the recipient. So, this field is optional, which means that if the source port is not specified the 16 bits of this field will be set to zero, in which case the recipient will not be able to respond (this is not strictly necessary, in particular for one way messages).
·         Destination port: This field contains the port corresponding to the application on the recipient machine to which it is sent.
·         Length: This field specifies the total length of the segment, header included, however, the header has a length of 4 x 16 bits (which is 8x8 bits) so the field length is necessarily greater than or equal to 8 bytes.
·         Checksum: This is a checksum conducted in such a way as to be able to check the integrity of the segment.

A number of UDP's attributes make it especially suited for certain applications.
§  It is transaction-oriented, suitable for simple query-response protocols such as the Domain Name System or the Network Time Protocol.
§  It provides datagrams, suitable for modeling other protocols such as in IP tunneling or Remote Procedure Call and the Network File System.
§  It is simple, suitable for bootstrapping or other purposes without a full protocol stack, such as the DHCP and Trivial File Transfer Protocol.
§  It is stateless, suitable for very large numbers of clients, such as in streaming media applications for example IPTV:

Ø  User Datagram Protocol (UDP) is Datagram oriented protocol with no overhead for opening, maintaining, and closing a connection.
Ø  User Datagram Protocol (UDP) is efficient for broadcast/multicast transmission.
Ø  User Datagram protocol (UDP) has only the basic error checking mechanism using checksums.
Ø  There is no sequencing of data in User Datagram protocol (UDP) .
Ø  The delivery of data cannot be guaranteed in User Datagram protocol (UDP). 
Ø  User Datagram protocol (UDP) is faster, simpler and more efficient than TCP. However, User Datagram protocol (UDP) it is less robust then TCP
Ø  Multiplexing and Demultiplexing is possible in User Datagram Protcol (UDP) using UDP port numbers.
Ø  There is no retransmission of lost packets in User Datagram Protcol (UDP).



Comparison of UDP and TCP
There are two types of internet protocol (IP) traffic, and both have very different uses.
1.  TCP(Transmission Control Protocol). TCP is a connection-oriented protocol, a connection can be made from client to server, and from then on any data can be sent along that connection.
o    Reliable - when you send a message along a TCP socket, you know it will get there unless the connection fails completely. If it gets lost along the way, the server will re-request the lost part. This means complete integrity, things don't get corrupted.
o    Ordered - if you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order.
o    Heavyweight - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.

2.  UDP(User Datagram Protocol). A simpler message-based connectionless protocol. With UDP you send messages(packets) across the network in chunks.
o    Unreliable - When you send a message, you don't know if it'll get there, it could get lost on the way.
o    Not ordered - If you send two messages out, you don't know what order they'll arrive in.
o    Lightweight - No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
TCP (Transmission Control Protocol) is a set of rules (protocol) used along with the Internet Protocol (IP) to send data in the form of message units between computers over the Internet. While IP takes care of handling the actual delivery of the data, TCP takes care of keeping track of the individual units of data (called packets) that a message is divided into for efficient routing through the Internet.
TCP is known as a connection-oriented protocol, which means that a connection is established and maintained until such time as the message or messages to be exchanged by the application programs at each end have been exchanged. TCP is responsible for ensuring that a message is divided into the packets that IP manages and for reassembling the packets back into the complete message at the other end. In the Open Systems Interconnection (OSI) communication model, TCP is in layer 4, the Transport Layer.
TCP offers seven major features.
  • Connection-oriented. An application requests a connection, and then uses it for data transfer.
  • Point-to-point communication. Each TCP connection has exactly two end points.
  • Reliability. TCP guarantees that the data sent across the connection will be delivered exactly as sent, without missing or duplicate data.
  • Full-duplex connection. A TCP connection allows data to flow in either direction at any time.
  • Stream interface. TCP allows an application to send a continuous stream of octets across the connection.
  • Reliable startup. TCP requires that two applications must agree to the new connection before it is established. Packets used in previous connections will not appear or otherwise interfere with the new connection.
  • Graceful shutdown. An application can open a connection, send data, then shut down the connection. TCP guarantees to deliver all the data reliably before closing the connection.

No comments:

Post a Comment