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