Mac Forums

Mac Forums (
-   OS X - Development and Darwin (
-   -   Java Mac LINUX connection using sockets (

shellback3 07-30-2012 11:31 AM

Java Mac LINUX connection using sockets
I'm finishing up a Java package that will provide communications among a few mostly headless computers on a LAN on an aircraft but I have only two LINUX boxes to use for testing. One is the "master" and the other a client. I thought that I would use my personal mac Air as another client to see if the system would work with more than one client but it has a point of failure. When either the LINUX master attempts to get the OS-X client name (Lion or Mountain Lion) or the client attempts to get the name of the master what I get is the respective computer's IP address. I use the computer name as a key in a map.

I'm fairly new to Java and quite new to sockets.

Here's the code. ipaddress and hostname are strings


try { 
    InetAddress machine = InetAddress.getByName(ipaddress); 
    hostName = machine.getHostName(); 
} catch (UnknownHostException e) { 
    Tell.sendMessage("getRemoteHostName: host name lookup failed for " + ipaddress); 
} catch (SecurityException e) { 
    Tell.sendMessage("getRemoteHostName: Security Exception: host name lookup failed for " + ipaddress); 

My computers are all connected to a router none is a server.

I've had no response to this question on a Java forum so thought I would try here.

Edit: no exception is thrown or caught.

All times are GMT -4. The time now is 09:36 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.