UDP provides a connectionless service as there need not be any long-term relationship
between a UDP client and server.
The TCP/IP protocol suite provides two transport protocols, the User Datagram Protocol (UDP) and the Transmission Control Protocol (TCP).There are some fundamental differences between applications written using TCP versus those that use UDP.
These are because of the differences in the two transport layers:
UDP is a connectionless, unreliable, datagram protocol, quite unlike the connectionoriented, reliable byte stream provided by TCP.
UDP is less complex and easier to understand.
1)The client does not establish a connection with the server.
2)The client just sends a datagram to the server using the sendto function, which requires the address of the destination as a parameter. Similarly, the server does not accept a connection from a client.
3)Instead, the server just calls the recvfrom function, which waits until data arrives from some client.
4)recvfrom returns the protocol address of the client, along with the datagram, so the server can
send a response to the correct client.
The UDP client and server are created with the help of DatagramSocket and Datagram packet classes. If the UDP protocol is used at transport, then the unit of data at the transport layer is called a datagram and and not a segment. In UDP, no connection is established.
If TCP is used for sending data, then the data is written directly to the socket (client or server) and reaches there as a connection exists between them.
No comments:
Post a Comment