FileDocCategorySizeDatePackage
UDPClient.javaAPI DocExample550Sun Jan 04 21:04:36 GMT 1998dcj.examples

UDPClient

public class UDPClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

      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();
      }