My *guess* is that getLocalHost returned the loop back interface on your linux box, but the NIC on your windows box,
This is a very common problem with moving to 1.4.x; previously, of course, java wouldn't let you bind to multiple addresses separately (IIRC it just bound to "all"?). The typical behaviour now - of binding to localhost on linux - is security-conscious (although an alternative method (e.g.
1
| getLocalHostNotLoopback() |
) that forced a non-localhost bindind OR THREW AN EXCEPTION would be nice).
I have no idea whether the linux behaviour is intentional or accidental (c.f. the quote below that implies it could be due to a silent security refusal), but the FAQ's on this topic all over the web just say "choose the correct InetAddress manually, or by iterating over all possible ones and binding to everything" and that always seems to work. Sadly there's a lot of crappy tutorials on the web that neglect to mention any of this

.
I don't know how it chooses what to return.
Quote (from J2SE 1.4.x docs:
" Returns the local host.
If there is a security manager, its checkConnect method is called with the local host name and -1 as its arguments to see if the operation is allowed. If the operation is not allowed, an InetAddress representing the loopback address is returned."
What it *doesn't* say is what it returns if the operation IS allowed - and my belief is that linux returns loopback for this too, whereas windows chooses the NIC. N.B. the definition of what IP address you'll be given based upon your own hostname is very fluid, and this could well be the cause of confusion - MANY linux systems have their hostname mapped to 127.0.0.1 (partly because lots of crap linux software - e.g. some FTP servers I've used - requires a mapping, and their docs often suggest you connect your hostname to 127.0.0.1 if you have a dynamic IP).
Anyway, welcome to the vague and woolly world of java's API docs...