Search code examples
javanetwork-programmingserverclient

Server access through private network


I am currently working on a server (I made using java) to share informations between computers within the same private network.

My problem is:

  • I can access this server through http://localhost or 127.0.0.1 on my "server machine"
  • but i cannot access it from another computer using the "server machine" local IP adress.

Trying with XAMPP, the port 80 is accessible by everyone but with my java server: no access, i got a "Timeout" exception from the remote client (still on the same private network)

My question is:

  • How is XAMPP (or Apache) able to forward port 80 to let every other computer access the "server machine" ?
  • What do i need to setup on MY server in order to let those computers access MY server ?

Solution

  • You are probably binding your application to localhost (127.0.0.1) only, making it reachable only from your machine.

    What do i need to setup on MY server in order to let those computers access MY server ?

    Try binding the app to other network interfaces, or simply try 0.0.0.0 for test (this will bind to ALL of them). Note that this is usually not a preferred method, especially if you have a public IP configured on that machine.

    How is XAMPP (or Apache) able to forward port 80 to let every other computer access the "server machine" ?

    Check the Apache module mod_proxy for this.