tags:

views:

208

answers:

3
+1  Q: 

Java sockets

I have implemented some remote method invocation using sockets opened on 127.0.0.1. During programs run, computers public IP address changes, because my program connects to net via GPRS modem from time to time. Can you tell me how does that affect my opened sockets? Java version is 1.3, windows platform. There are several network interfaces and their ip address changes over time (+VPN connection is established). But client and server are on the same machine, and use 127.0.0.1 to establish connection over sockets. Is there any way that this address changing over these network interfaces affects 127.0.0.1 communication.

+7  A: 

Beyond the obvious question of why on God's green earth you're using Java 1.3 (when Java 1.4 is no longer supported), localhost is localhost. It's not impacted by whatever IP address your modem (GPRS or otherwise) assigns you. It's fine.

cletus
+1 for "why on God's green earth "
Markus Lausberg
code is in process of moving to java version 1.6.0.11 ;)
tropikalista
That will be an interesting transition. :)
Bill the Lizard
There's plenty of 1.1 code still in production. Things have one downhill from there, anyway :)
I interviewed somewhere last year that was still on java 1.2 ... I was mad confused
I'd run to the hills from anyplace that didn't use at least Java 5.
cletus
I'd want to see 1.3 -> 1.6 transition just for the kicks since there's bound to be tons of Generics, foreach and varargs related refactorings at least, not to mention all the possibly fixed API:s and replacements etc. :D
Esko
You cannot defeat the loopback.
windfinder
@Esko transition went well so far, refactoring will be part of the next patches, when we come along those issues they will be solved. core functionalities work very well @windfinder details please?
tropikalista
@windfinder no need for details :)
tropikalista
+2  A: 

did you for sure bind to the localhost address on the server?

ServerSocket(int port, int backlog, InetAddress bindAddr)

l_39217_l
A: 

localhost will work even if you pull out your network connections and disable or remove all your network adapter.

Peter Lawrey