class TCPThread extends Thread { //这三个静态属性,在外部被通过TCPThread.Min_port设置 public static InetAddress hostAddress; public static int MIN_Port; public static int MAX_Port; public static int MAX_Thread; private int threadnum;
private ScanFrame frame; // ScanFrame 是swing的图形窗口Frame子类,这里简略不列出ScanFrame的代码
public TCPThread(String name,int threadnum,ScanFrame frame){ super(name); this.threadnum = threadnum; this.frame=frame; } public void run() { int i; Socket theTCPsocket; for (i = MIN_Port+threadnum; i < MAX_Port; i += MAX_Thread) { frame.label_Status.setText("状态:扫描 "+i+" 端口"); ...
|