Java tutorial
import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; class DatagramSender { public static void main(String args[]) throws Exception { InetAddress ia = InetAddress.getByName(args[0]); // Obtain destination port int port = Integer.parseInt(args[1]); // Create a datagram socket DatagramSocket ds = new DatagramSocket(); // Create a datagram packet byte buffer[] = args[2].getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, port); ds.send(dp); } }