tropikalista
tropikalista

Reputation: 1629

Are localhost sockets affected when public IP address changes

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.

Upvotes: 1

Views: 737

Answers (3)

Peter Lawrey
Peter Lawrey

Reputation: 533550

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

Upvotes: 1

l_39217_l
l_39217_l

Reputation: 2110

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

ServerSocket(int port, int backlog, InetAddress bindAddr)

Upvotes: 2

cletus
cletus

Reputation: 625097

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.

Upvotes: 7

Related Questions