Sending UDP Datagrams
To send data to a particular server
- Convert the data into byte array.
- Pass this byte array, the length of the data in the array (most of the time this will be the length of the array) and the InetAddress and port to which you wish to send it into the DatagramPacket() constructor.
- Next create a DatagramSocket and pass the packet to its send() method