In: Computer Science
1. Explain one aspect of UDP that makes it better than TCP.
2. Explain what is a socket.
3. Explain the difference in demultiplexing between UDP and TCP.
4. Illustrate a system of your choice with Finite State Machine.
1. In UDP we have no connection establishment. TCP uses a three-way handshake before it starts to transfer data. UDP just blasts away without any formal preliminaries. Thus UDP does not introduce any delay to establish a connection. This is probably the principal reason why DNS runs over UDP rather than TCP—DNS would be much slower if it ran over TCP.
2. A socket is the interface between the application process and the transport-layer protocol. The application at the sending side pushes messages through the socket. At the other side of the socket, the transport-layer protocol has the responsibility of getting the messages to the socket of the receiving process. The socket mechanism provides a means of inter-process communication (IPC) by establishing named contact points between which the communication take place.
3. For demultiplexing in UDP we need source port number field and the destination port number field. A UDP socket is fully identified by a pair consisting of a destination IP address and a destination port number. As a consequence, if two UDP segments have different source IP addresses and/or source port numbers, but have the same destination IP address and destination port number, then the two segments will be directed to the same destination process via the same destination socket.
One major difference between a TCP socket and a UDP socket is that a TCP socket is identified by a quadruple: (source IP address, source port number, destination IP address, destination port number). Thus, when a TCP segment arrives from the network to a host, the host uses all four values to demultiplex the segment to the appropriate socket.
4. I am not sure to what the system in here is referring to. I think it is either of TCP or UDP. So I have solved this part using that assumption only. Please tell me in the comments below if it is something else.
The follwing figure is of the TCP finite state machine