Python Sockets: Connection Timeout
Question: I'm trying to write two short python scripts that will connect two or more
machines to each other, one as the server and the others as clients. It worked
perfectly when testing the client and the server script on the same computer,
but when I tried it from another computer the client kept timing out; it
couldn't connect to the server. Here's my server code:

    
    
    import socket
    server = socket.socket()
    host = "computername"
    port = 12345
    server.bind((host, port))
    server.listen(5)
    
    client, addr = server.accept()
    

Client code:

    
    
    import socket
    server = socket.socket()
    host = "computername"
    port = 12345
    server.connect((host, port))
    

Any clue as to why the machines can't connect?


Answer: I think, you are changing host variable properly when running both client and
server scripts in different machines. Try by changing that properly/or using
IP address of server machine.

