我也帮你顶,我也碰到这样的问题了?
楼主你的问题解决了吗?
楼主你的问题解决了吗?
解决方案 »
- socket 传文件 DataInputStream.readInt()时,读出乱数据~~请大家帮忙看看,谢谢了
- 关于Map List 之间的用法 具体如下:
- 怎样学好JAVA OO思想,应该买什么书!
- 关于Comparator接口问题
- spring+struts+hibernate整合需要下载什么东西?
- web.xml中jndi引用
- Struts validation 的问题,请高手解说。
- 使用JBuilder 8 的向导创建实体Bean时遇到的bug! 急!!!!!!
- 什么是ant
- 项目中出现的问题,在action中调用服务层方法时出错,请帮忙看看 谢谢
- 计算到2个时间之间间隔的工作日
- JBuilder2006在座Struts时的一个问题。
import java.net.*;
import java.util.*;
public class SocketPort { public static void main(String[] args) { String ip = "192.168.20.104";
String hostname = new String(); try{ //get the target ip address and hostname
InetAddress address = InetAddress.getByName(ip);
System.out.println(address);
hostname = address.getHostName();
System.out.println(hostname);
}
catch(UnknownHostException e)
{
System.out.println("Could not find "+ ip); }
try
{ // creat the output file
PrintWriter fout = new PrintWriter( new FileWriter("PortInf.txt"));
fout.println("Information Of The Port On the " + hostname +"computer ");
fout.println(); // do ports scan
for(int nport = 25;nport < 30;++nport)
{
try
{ Socket s = new Socket(hostname,nport);
fout.println("The port " + nport + " is open!"); fout.println("Connected to "+ s.getInetAddress() + " on port " + s.getPort() + " from port "+ s.getLocalPort() + " of " + s.getLocalAddress());
//print the connected socket information
} catch(IOException e)
{
fout.println("The port " + nport + " is closed!");
} }
fout.close(); }
catch(IOException e){} }
}