Finger client
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.Socket; import java.util.StringTokenizer; public class Finger { public static void main(String[] arguments) throws Exception { StringTokenizer split = new StringTokenizer(arguments[0], "@"); String user = split.nextToken(); String host = split.nextToken(); Socket digit = new Socket(host, 79); digit.setSoTimeout(20000); PrintStream out = new PrintStream(digit.getOutputStream()); out.print(user + "\015\012"); BufferedReader in = new BufferedReader(new InputStreamReader(digit.getInputStream())); boolean eof = false; while (!eof) { String line = in.readLine(); if (line != null) System.out.println(line); else eof = true; } digit.close(); } }