FileDocCategorySizeDatePackage
UDPEchoClient.javaAPI DocExample722Thu Apr 03 15:25:52 BST 1997None

UDPEchoClient

public class UDPEchoClient extends Object

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


    String hostname;
    int echoPort = 7;

    if (args.length > 0) {
      hostname = args[0];
    }
    else {
      hostname = "localhost";
    }

    try {
       InetAddress ia = InetAddress.getByName(hostname);
       DatagramSocket theSocket = new DatagramSocket();
       echoInputThread eit = new echoInputThread(ia, theSocket);
       eit.start();
       echoOutputThread eot = new echoOutputThread(theSocket);
       eot.start();
    }
    catch (UnknownHostException e) {
      System.err.println(e);
    }
    catch (SocketException se) {
      System.err.println(se);
    }