package Socket;
import java.io.IOException;
import java.net.Socket;
public class TestSocket {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("args是:"+args.length);
String host="localhost";
if(args.length>0){
host=args[0];
}
for(int i=1;i<=1024;i++){
try {
Socket s=new Socket(host,i);
System.out.println("port"+i+"can use");
} catch (IOException e) {
}
}
System.out.println("Scanner over!");
System.exit(0);
}
}