UDP:User Datagram Protocol [RFC 768] "no frills,""bare bones" Internet transport Why is there a UDP? protocol no connection r "best effort"service,UDP establishment (which can segments may be: add delay) m lost r simple:no connection state m delivered out of order at sender,receiver to app r small segment header r connectionless: no congestion control:UDP m no handshaking between can blast away as fast as UDP sender,receiver desired m each UDP segment handled independently of others Transport Layer 3-16
Transport Layer 3-16 UDP: User Datagram Protocol [RFC 768] r “no frills, ” “bare bones” Internet transport protocol r “best effort” service, UDP segments may be: m lost m delivered out of order to app r connectionless: m no handshaking between UDP sender, receiver m each UDP segment handled independently of others Why is there a UDP? r no connection establishment (which can add delay) r simple: no connection state at sender, receiver r small segment header r no congestion control: UDP can blast away as fast as desired
UDP:more r often used for streaming multimedia apps 32 bits m loss tolerant Length,in source port dest port m rate sensitive bytes of UDP length checksum r other UDP uses segment, including m DNS header m SNMP r reliable transfer over UDP: Application add reliability at data application layer (message) m application-specific error recovery! UDP segment format Transport Layer 3-17
Transport Layer 3-17 UDP: more r often used for streaming multimedia apps m loss tolerant m rate sensitive r other UDP uses m DNS m SNMP r reliable transfer over UDP: add reliability at application layer m application-specific error recovery! source port # dest port # 32 bits Application data (message) UDP segment format length checksum Length, in bytes of UDP segment, including header
UDP checksum Goal:detect "errors"(e.g.,flipped bits)in transmitted segment Sender: Receiver: r treat segment contents as r compute checksum of sequence of 16-bit received segment integers r check if computed checksum r checksum:addition (1's equals checksum field value: complement sum)of m NO error detected segment contents m yES no error detected. r sender puts checksum But maybe errors value into UDP checksum nonetheless?More later field Transport Layer 3-18
Transport Layer 3-18 UDP checksum Sender: r treat segment contents as sequence of 16-bit integers r checksum: addition (1’s complement sum) of segment contents r sender puts checksum value into UDP checksum field Receiver: r compute checksum of received segment r check if computed checksum equals checksum field value: m NO - error detected m YES - no error detected. But maybe errors nonetheless? More later …. Goal: detect “ errors” (e.g., flipped bits) in transmitted segment
.UDP Checksum is the 16-bit one's complement of the sum of a pseudo header of info from the IP header,the UDP header,and the data,padded with zero octets at the end (if necessary)to make a multiple of two octets. .The pseudo header conceptually prefixed to the UDP header contains the source address(32),the dest address(32),zeros(8),the protocol(8),and the UDP length(16).This info gives protection against misrouted datagrams. .While computing the checksum,the checksum field itself is replaced with zeros. .According to the rules of two numbers in one's complement,if the adding generates a carry,the carry is added to the result Transport Layer 3-19
Transport Layer 3-19 •UDP Checksum is the 16-bit one’s complement of the sum of a pseudo header of info from the IP header, the UDP header, and the data, padded with zero octets at the end (if necessary) to make a multiple of two octets. •The pseudo header conceptually prefixed to the UDP header contains the source address(32), the dest address(32), zeros(8), the protocol(8), and the UDP length(16). This info gives protection against misrouted datagrams. •While computing the checksum, the checksum field itself is replaced with zeros. •According to the rules of two numbers in one’s complement, if the adding generates a carry, the carry is added to the result
Source addr Dest addr I Zero Length Source port Dest port Length Checksum Data Transport Layer 3-20
Transport Layer 3-20 Source addr Dest addr Zero Protocol Length Source port # Dest port # Length Checksum Data