Datagram in network environment

In a network environment the client and the server communicate with each-other by reliable channel like TCP socket which have dedicated point-to-point channel between client and server.

Datagram in network environment

In a network environment the client and the server communicate with each-other by reliable channel like TCP socket which have dedicated point-to-point channel between client and server.

Datagram in network environment

Datagram in network environment

     

In a network environment the client and the server communicate with each-other by reliable channel like TCP socket which have dedicated point-to-point channel between client and server. All data sent over the channel is received and sent in the same order. 
  
In other case the application, which communicate by datagrams sends and receives completely independent packets of information and they also don?t need a dedicated point-to-point channel.

Datagrams are simply a bundles of information data passed between machines. Java implements datagrams on top of the UDP protocol by using three classes which are in java.net package as well as define as under :

  • DatagramSocket
  • DatagramPacket
  • MulticastSocket

In which the DatagramPacket is used to contain data for sent and receive by a application and the DatagramSocket is used to send or receive the DatagramPackets over the network envirnoment. While the Multicast socket is used to broadcast the DatagramPackets to multiple recipients.