Sharing Localhost on Network in Windows 7
Solution 1:
If I'm understanding you right you want localhost
on machines A and B to point to the same place -- This is simultaneously exactly what's happening and completely impossible :-)
localhost
by convention always points to 127.0.0.1
, the magic loopback IP of the local machine (i.e. 127.0.0.1 on machine A always means machine A; 127.0.0.1 on machine B always means machine B). It's not an address that can be shared between multiple machines (in fact the entire 127.0.0.0/8
network is reserved for loopback use).
To do what you want you need to connect both machines over a network, assign them non-loopback IPs (private addresses out of 10.0.0.0/8
, 172.16.0.0/12
or 192.168.0.0/16
) & run your service over those addresses.
Consult a good networking book for more details...