UDP Flashcards
Describe the steps of a UDP client
1) Make a DatagramSocket
2) Make a DatagramPacket with payload and destination (server) host & port
3) .send the DatagramPacket a UDP packet
4) Make an empty DatagramPacket
5) .receive the next UDP packet into that DatagramPacket
Describe the steps of a UDP server
1) Make a DatagramSocket with known port
2) (repeat)
3) Make an empty DatagramPacket
4) .receive the next UDP packet into that DatagramPacket
5) …
6) Make a DatagramPacket with payload
7) .send the DatagramPacket as a UDP packet
Name 4 UDP considerations
Message size, blocking, receive from any, failure model
Describe message size
Hard limit of 65508 bytes but often 8k or less
Larger messages are broken up into smaller fragments on most physical networks and is reassembled by the receiver - less reliable
Describe blocking
Receive normally blocks until a message is received
Describe receive from any
Normally a socket will accept messages from any sender
Describe failure model
Best effort like IP
Checksums detect most corruption of messages and discard them
Messages may be dropped due to corruption, no space in buffer at end system or in network (congestion)
Messages may arrive out of order and may be occasionally duplicated
Describe the uses of TCP