User Datagram Protocol

Defined in RFC 768 to be a minimal message-oreiented transport layer.

This protocol provides a procedure for application programs to send messages to other programs with a minimm of protocol mechanisms. The protocol is transaction orientated, and delivery and duplicate protection are not guaranteed. Applications requiring ordered reliable delivery of streams of data should use the transmission control protocol.

UDP is a simple protocol, there is no error detection, no error correction, no connection-oriented links, no verification of delivery order. It is a simple datagram delivery service. Without added features, it is easy to implement with minimal overhead. It can be used in low intensity tasks performed in the background, such as routine network monitoring.

Properties

  • Provides no guarantees to the upper layers on message delivery
  • Is stateless - retains no state of UDP messages once sent
  • Suitable for very large numbers of clients, such as in streaming applications
  • Good for unidirectional communication as in stock market distribution

Datagrams

Data is sent across the network layer in finite packets. Each datagram contains a header and a payload. Each datagram contains a single message. A message may be a request or a reply to a request. They provide minimal transport layer functions, and uses a minimal header structure.

  • Source port field is 16 bits long (assigned by the originating host
  • Destination port field is 16 bits long
    • Usually well known port associated with application
    • Domain name service - port 53
  • UDP message length field is 16 bits
    • Indicates length in bytes of entire datagram

Datagram header

The header contains the address and port where the packet is going (destination); address and port from where the packet was sent from (origin) and other information used for transmission

Well known port examples

Application Protocol Port Network Protocol
Echo 7 TCP/UDP
Daytime 13 TCP/UDP
SMTP 25 TCP
Time 37 TCP/UDP
HTTP 80 TCP
POP3 110 TCP

Ephemeral ports

The upper limit (depending on operating system configuration is 1024. It is necessary for server software to have a specific port to listen for incoming traffic on. It does not need to operate out of the same port at all times. Ephemeral ports allows for each client session to run on a unique port.

DatagramSocket class

DatagramSocket is required to send or recieve a DatagramPacket. All datagram sockets are bound to a local port which listens for incoming data and places a datagram header into outgoing data.

UDP multicast

A and B multicast channels

A single class D IP addresses and port defines one multicast channel.

To mitigate the unreliability of UDP, the data can be sent over two different channels. It is critical that these are routed differently through the network known as geographically diverse routing. These are known as the A and B channels in the industry.

Mitigation of UDP unreliability

Following from previously, the client software will recieve the same message twice (or maybe still not at all). The client software has to be programed to handle this. Every message has to have a unique number so that the client software can detect receiving the same message a second time; gaps in the sequence of messages; never receiving some messages.

Line arbitrage is the algorithm used to receive ONE and only ONE instance of a message - arbitrate between line A and B. There is a fall back TCP connection to the exchange to request any missed messages. Note that there is also continuous rebroadcasting on a separate set of UDP multicast channels.

The burden of creating reliable comms from layer four in the operating system has been shifted onto the application programmer (the linehandler). Appartently it is still faster to operate this way than to se the TCP FSMs in the ultra low latency environment.