Socket Programming – Part 2

Difference between UDP and TCP
1. UDP(User Datagram Protocol) Connection
udp
i. In UDP connection (connectionless service) client doesn’t establish a connection with the server. Instead the client just sends a datagram to the server using the sendto( ) system call, which requires the address of destination (server) as a parameter.
ii. Similarly the server does not have to accept a connection from a client. Instead the server just issues a recvfrom( ) system call that waits until data received from some client. The recvfrom( ) system call returns the network address of the client process, along with the datagram so server can send its respond to the correct process.
iii. In UDP there is no sequencing of data.
iv. In UDP delivery of data can’t be guaranteed.
v. UDP is faster, simple and more efficient then TCP.
vi. In UDP there is no retransmission of lost packets.

2. TCP(Transmission Control Protocol) Connection
tcp
i. In TCP connection (connection oriented) client establish a connection with the server. Client issue the connect( ) system call to connect to server, while server accept the connection using accept( ) system call.
ii. TCP assure reliable delivery of data to the destination.
iii. TCP provides error checking mechanisms such as flow control and acknowledgement of data which make TCP comparatively slow.
iv. TCP delivers the data in sequence and delivery of data is guaranteed.
v. In TCP retransmission of lost packets is possible.

2 Replies to “Socket Programming – Part 2”

Leave a Reply

Your email address will not be published. Required fields are marked *