What is the purpose of the code below?
try (DatagramSocket mySocket = new DatagramSocket()) {
String text = "Hello";
byte[] message = text.getBytes();
DatagramPacket packetS = new DatagramPacket(message, message.length,
InetAddress.getLocalHost(), 2000);
mySocket.send(packetS);
byte[] buffer = new byte[1024];
DatagramPacket packetR = new DatagramPacket(buffer, buffer.length);
mySocket.receive(packetR);
System.out.println("Received: " +
new String(packetR.getData()).trim());
} catch (IOException e) {
System.out.println(e);
}