I'm trying to make a TCP chat on port 10 000, I have a linux server on which I'm listening :
NETSTAT report :
tcp 0 0 127.0.0.1:10000 0.0.0.0:* LISTEN
NMAP report :
10000/tcp open snet-sensor-mgmt
But I can not seem to get a connection when trying to reach out to the server from my home computer with the following code:
def sock_connect (server,port) :
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = (server,port)
print ('[+] Connecting to %s ...' % server)
sock.connect(server_address)
print('[+] Successfully connected to %s' % server)
return(sock)
Please note, it all works perfectly on my localhost. I have allowed all port 10000 incoming traffic on my server but I have no portforwarded or configurated anything on my home router, could that be the problem ?
Thanks in advance for your help!
Like Xiwei Wang commented, the solution was to listen on 0.0.0.0 Thanks again !