import java.net.*;
import java.io.*;

public class LowPortScanner {
public static void main(String[] args) {
String host = “www.163.com";

if (args.length == 1) {
host = args[0];
}
for (int i = 79; i < 83; i++) {
try {
Socket s = new Socket(host, i);

System.out.println(
“there is a server on port " + i + " of " + host);
} catch (UnknownHostException e) {
System.err.println(“UnknownHost");
} catch (IOException e) {
System.err.println(e + “port " + i);
}
}
}
}