try {
DatagramSocket s = new DatagramSocket();
byte[] data = "Hello".getBytes();
InetAddress addr = InetAddress.getByName("localhost");
DatagramPacket p = new DatagramPacket(data, data.length, addr, 5000);
s.send(p);
}
catch (Exception e) {
System.out.println("Client got exception:");
e.printStackTrace();
}