0

Basically - I am producing a website and I am trying to share the "localhost" port on 2 computers.

Basically, when I build the project I just want to also be able to access it on both computers via the same port.

Currently, I cant seem to be able to do this ? Anyone can help with step-by-step ?

Thx

1 Answer 1

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...

2
  • hi :) no sorry maybe I made a mistake. Basically on Machine 1 - its 127.0.0.1:81 and I want machine 2 to be able to access this address so it can see the website ?
    – Tom
    Mar 9, 2010 at 16:37
  • Re-read the answer above: 127.0.0.1 is unique to each machine and cannot be shared across hosts: you must use non-loopback addresses to do what you want.
    – voretaq7
    Mar 9, 2010 at 16:49

You must log in to answer this question.