0

java 端口扫描

Posted in Java at 三月 24th, 2010 / No Comments »

import java.net.*;
import java.io.*;
 
public class PortScan1
{
 private String IPAddress;
 private int Port;

 public void run()
 {
  try
  {
   Socket TestPort = new Socket(“192.168.8.100″, 80); //if this port cannot been connected, throw a exception.
   System.out.println(“ok”); //if connected, print ok.
  }
  catch(Exception e)
  {
   //this.result=”failed”; //if not connected, print failed.
  }
 }

 public static void main(String[] args)
    {
  PortScan1 PortScan1 = new PortScan1();
  PortScan1.run();
 }
}

Published in Java

No Responses to “java 端口扫描”

Leave a Reply

请输入算式结果(看不清请点击图片)
(必须)