I am using the following code to open a socket on my computer. When I go to my_ip:5000 on my computer the program responds. However, when I use another computer, nothing happens.
HOST = 'my_ip' # Symbolic name meaning the local host
PORT = 8000 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
data = conn.recv(1024)
if not data: break
conn.send(data)
conn.close()
I'm not sure if this is an issue with the firewall or not. When I start up the test server in django using manage.py runserver my_ip:8000 I am able to connect to the machine from a different computer. I'm not sure what is causing me not to be able to connect from another computer using the code above...
my_ipin to the machine the above code is running on it works. However when I use a different machine, nothing.