- InetAddress used mostly for DNS queries and for representing destination addresses.
- DatagramSocket as the endpoint of each datagram exchange.
- DatagramPacket as the data exchanged through DatagramSocket objects.
InetAddress methods getByName and getAllByName will be used to obtain the IP adresses of a host. And send and receive methods of DatagramSocket objects will be used for exchanging DatagramPacket objects between hosts.
Remember that UDP has not the concept of a connection, so a server can receive datagrams belonging to different conversations (with different clients) through the same socket.
There is not such a thing as a DatagramServerSocket.
No comments:
Post a Comment