Let Us Know About User Datagram Protocol

This resource contain the information about User Datagram Protocol.

User Datagram Protocol

User Datagram Protocol is used in transmission of data from one application to another application through socket. The User Datagram Protocol is a subset of Transmission Control Protocol (TCP) / Internet Protocol (IP).

The fixed size data of byte type is transmitted through User Datagram Protocol. This data is termed as datagram packet. The datagram packet consists of data fixed size and address of remote locates. The destination packet automatically locates the destination on which another application is running. There is no concept of server or client application but requires two application of which one application transmits the data at one end and other application receives the data on another end. The User Datagram Protocol application is not considered reliable for transmitting and receiving the data packets.
User Datagram Protocol is developed by following two classes in java the application
1. Java.net. Datagram Packet class
2. Java.net. Datagram Socket class

Datagram Packet class
This class denotes the packet object that she'll be transmitted or received by DatagramPacket object.
Methods of DatagramPacket class:-
1. Byte[] getData()
This method returns the data in byte Array format.
2. int getLength()
This method returns the length or size of byte Array data.
3. int getPort()
This method returns the port number of remote application.
4. InetAddress getAddress()
This method returns the address IP of remote application.

DatagramSocket class
The object of this class is used to create a port and then transmit or receive a data in the form of DatagramPacket object.
Method of DatagramSocket class:-
1. Void send(DatagramPacket obj)
This method is used to transmit the data in the form of DatagramPacket object.
2. Void receive(DatagramPacket obj)
This method is called by invoking DatagramSocket object to receive the datagramPacket object that transmitted from another end.

More articles: UDP Computer Networks


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: