How to send to receive datagram packet?
DatagramSocket s = new DatagramSocket(null);
Which is equivalent to:
DatagramSocket s = new DatagramSocket(8888);
Both cases will create a DatagramSocket able to receive broadcasts on UDP port 8888.
One can create a packet as:
DatagramPacket packet = new DatagramPacket(message, message.length, address, DAYTIME_PORT);
To send or receive a packet, the sockets send or receive methods can be used: