1
UDP Sockets
Internet Application Development
T UDP stands for User Datagram Protocol. UDP provides an unreliable packet delivery system built on top of the IP
- protocol. As with IP, each packet is an individual, and is
handled separately. T Because of this, the amount of data that can be sent in a UDP packet is limited to the amount that can be contained in a single IP packet (approx. 64k). T UDP packets are stamped with client and server addresses and port numbers. T They can arrive out of order or not at all. No packet has any knowledge of the preceding or following packet. The recipient does not acknowledge packets, so the sender does not know that the transmission was successful.
Java UDP Sockets
Internet Application Development Server Client
Internet Internet
packet packet send receive Server packet send receive
UDP connections are used in a slightly different way to TCP sockets - they act like the postal service rather than a telephone.
UDP Sockets
Internet Application Development
T Clients that have one request and one response use UDP. UDP has low start-up overheads. Examples of its use include DNS (Domain Name Service) and NFS. T UDP is potentially unreliable and has no notion of the presence of undetected errors in transmission. The data integrity is guaranteed, because check summing is employed, but its delivery and sequence is not. T UDP packets may be corrupted in transit, lost due to congestion in a router, or lost due to buffer overrun in the receiver's buffer. T In all cases their is no indication given to the sending process - in other words - packets can just disappear !!
TCP versus UDP Sockets
Internet Application Development
T The advantages of TCP is that is has high reliability, and allows message verification. It is used when all data that is sent must arrive. For instance it provides a reliable way to send chat text and to send animation key frames. T The advantages of UDP are all based around speed -it’s a more simpler protocol than TCP and has less overheads. It is good for things such as the efficient transmission of animation sub-frames and is generally very useful for sending information that will be updated at short intervals - such as video and audio. T TCP is probably a better choice for communication between networks under high traffic conditions. UDP, on the other hand, is broadcast-capable and provides high performance.
TCP versus UDP Sockets
Internet Application Development
T When applications developers create programs for TCP/UDP/IP networks, they can choose TCP or UDP at the transport layer. T The main difference (as far as this module is concerned) is that TCP provides reliability control services, while UDP trades off those services to improve performance. T Most applications use TCP because reliability is crucial. For example, FTP uses TCP to ensure that an exact copy of a file is delivered to the recipient. Multimedia applications use UDP because they can tolerate some loss. T Actually, multimedia applications often run RTP (Real- time Transport Protocol) on top of UDP. RTP is a service for controlling the transmission rate of multimedia.
TCP versus UDP Sockets
Internet Application Development
T One more major difference between TCP and UDP sockets is the way they transfer data. T In fact, they are fundamentally different in their data
- model. TCP is stream-based (as we have seen in the
tutorials) and UDP is datagram-based. T This means that with UDP, if data is lost or delivered out of
- rder, it happens with datagram granularity.