Establishing a socket connection between computers?
<p>I was learning about networking and I have some trouble understanding what went wrong.</p>

<p>I created a Client and a Server script:</p>

<p>Server:</p>

<pre><code>import socket 

s = socket.socket()
host = socket.gethostname()
port = 12345 
s.bind((host,port))  

s.listen(5)
while True: 
    c, addr = s.accept() 
    print ("Got connection from: " ,addr) 
    c.send("Thanks".encode('utf-8'))
    # c.sendto(("Thank you for connection").encode('utf-8'), addr)
    c.close()
</code></pre>

<p>and Client:</p>

<pre><code>import socket 

s=socket.socket()
host=socket.gethostname()
port = 12345

s.connect((host,port))
c=s.recv(1024)
print (c)

s.close
</code></pre>

<p>When I am trying to run from my computer I have no problem (both scripts)
But when I am running the Client from another Computer, the following error pops up for the Client: <code>ConnectionRefuseError: WinError10061 No connection could be made because the target machine actively refused it</code>.</p>

<p>Got any idea what could fix this?</p>

<p>The problem was that I wasn't referring to the server IP when running from another computer, I fixed it by passing the server IP, in the client script, like this host = "10.x.x.x"</p>

<p>Sorry for creating a useless question! </p>

python sockets networking communication