wood burning stoves
The moose likes Distributed Java and the fly likes networking problem :-( ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "networking problem :-( ??" Watch "networking problem :-( ??" New topic

networking problem :-( ??

Jonk kulsh

Joined: Feb 04, 2005
Posts: 7
The code given below is working for windows but its giving problem in MAC OS
In window platform its revaling host address & name if u given address or name of particular comp in network but cudn't revaling the name or ip address of MAC OS on the network,while in MAC OS this code ain't workn at al

import java.net.InetAddress;
import java.net.UnknownHostException;

public class GetInetInfo{
public static void main(String[] args){
if (args.length != 1) {
System.err.println("Usage: GetInetInfo address");
// System.exit(1);

InetAddress address = null;
try {
address = InetAddress.getByName(args[0]);
} catch(UnknownHostException e) {
// System.exit(2);
System.out.println("Host name: " + address.getHostName());
System.out.println("Host address: " + address.getHostAddress());

// System.exit(0);
} // GetInetInfo

the err i'm getn in MAC OS::

java.net.UnknownHostException: datacentre: datacentre
at java.net.InetAddress.getAllByName0(InetAddress.java:948)
at java.net.InetAddress.getAllByName0(InetAddress.java:918)
at java.net.InetAddress.getAllByName(InetAddress.java:912)
at java.net.InetAddress.getByName(InetAddress.java:832)
at GetInetInfo.main(GetInetInfo.java:12)
I agree. Here's the link: http://aspose.com/file-tools
subject: networking problem :-( ??