Reputation: 25
I currently have the problem that I have a server script running on one computer as localhost:12123
. I can connect to it using the same computer but using another computer in the same network does not connect to it (says it does not exist). Firewall is disabled.
Does it have to do with permissions?
The socket is created by a python file using BaseHTTPServer
.
Upvotes: 1
Views: 3541
Reputation: 6281
It probably has to do with binding to localhost, instead to the actual LAN interface (e.g. 192.168.1.x) or all interfaces (sometimes referred as 0.0.0.0).
This code would start an instance that binds to all interfaces (not only localhost)
def run(server_class=BaseHTTPServer.HTTPServer,
handler_class=BaseHTTPServer.BaseHTTPRequestHandler):
server_address = ('0.0.0.0', 12123)
httpd = server_class(server_address, handler_class)
httpd.serve_forever()
server_adress
has to be (0.0.0.0, 12123)
see: 0.0.0.0
Upvotes: 6