Worked out what it was:
The code was calling InetAddress.getLocalHost(), which was only returning the correct address when the two PC's had static IP address, ie, when they were connected by a cross-over cable! Had to implement a java security policy file to allow the code to query a remote DNS...