FileDocCategorySizeDatePackage
finger.javaAPI DocExample823Thu Apr 03 15:22:54 BST 1997None

finger

public class finger extends Object

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


       

    String hostname;
    Socket theSocket;
    DataInputStream theFingerStream;
    PrintStream ps;

    try {
      hostname = args[0];
    }
    catch (Exception e) {
      hostname = "localhost";
    }

    try {
      theSocket = new Socket(hostname, port, true);
      ps = new PrintStream(theSocket.getOutputStream());
      for (int i = 1; i < args.length; i++) ps.print(args[i] + " ");
      ps.print("\r\n");
      theFingerStream = new DataInputStream(theSocket.getInputStream());
      String s;
      while ((s = theFingerStream.readLine()) != null) {
        System.out.println(s);
      }
    }
    catch (IOException e) {
      System.err.println(e);
    }