What Is a Datagram?
by, 04-25-2012 at 11:50 PM (931 Views)
Servers & clients which do communication through reliable channels like a socket or URL, consists of point to point and dedicated channels b/w them or at least one illusion. For communication, connection is established, data is transmitted , and lastly connection is closed. Data that has been sent at the channel is obtained in similar order in which originally one sent it. Channel provides the guarantee.
On the other hand communication of application is done through datagrams which receive/send not depending upon the information packets. Server and client donít require dedicate point to point channels. Datagrams are delivered to destination or not couldnít be guaranteed. There is also no arrival order.
Datagram is considered as a self contained & independent message that is being sent over the networks, whose arrival time or content is not being guaranteed.
Two classes are present in java.net package to assist you in writing java programs which use datagrams for receiving or sending packet, over the network: MulticastSocket, DatagramPacket and DatagramSocket. DatagramPackets could be sent or received by an application via DatagramSocket. Additionally, it is possible to broadcast the DatagramPackets to various recepients who all listen to MulticastSocket.