大侠们,有没有相关的代码? 谢谢了。

解决方案 »

  1.   

    InetAddress address = InetAddress.getByAddress(byte[] addr);addrees会以hostname/address的形式toString()6.1.1.3 public static InetAddress getByAddress(byte[ ] address) throws UnknownHostException // Java 1.4public static InetAddress getByAddress(String hostName, byte[] address) throws UnknownHostException // Java 1.4
    In Java 1.4 and later, you can pass a byte array and optionally a hostname to getByAddress() to create an InetAddress object with exactly those bytes. Domain name lookup is not performed. However, if byte array is some length other than 4 or 16 bytes—that is, if it can't be an IPv4 or IPv6 address—an UnknownHostException is thrown.This is useful if a domain name server is not available or might have inaccurate information. For example, none of the computers, printers, or routers in my basement area network are registered with any DNS server. Since I can never remember which addresses I've assigned to which systems, I wrote a simple program that attempts to connect to all 254 possible local addresses in turn to see which ones are active. (This only took me about 10 times as long as writing down all the addresses on a piece of paper.)getByAddress(byte[] address) really doesn't do anything getByAddress(String address) doesn't do. In a few cases, it might be marginally faster because it doesn't have to convert a string to a byte array, but that's a trivial improvement. getByAddress(String hostName, byte[] address) does let you create InetAddress objects that don't match or even actively conflict with the information in the local DNS. There might occasionally be a call for this, but the use case is pretty obscure.
      

  2.   

    http://community.csdn.net/Expert/topic/4304/4304466.xml?temp=.884701
      

  3.   

    反向域名要DNS支持,一般是不可能实现的
      

  4.   

    Process p = Runtime.getRuntime().exec("cmd.exe /c ping -a ip");
     InputStream is = p.getInputStream(); 分析此输出流可以得到IP转域名,域名转IP.
      

  5.   

    to 
     skycncomp(风无行) 
    只有当你访问过的网址才能用ping -a得到域名(因为你系统的缓冲中有了)
      

  6.   

    InetAddress address = InetAddress.getByAddress(byte[] addr);addrees会以hostname/address的形式toString()