I'm trying to connect in a virtual machine local with 2 python scripts. One for the server and one for the client. When I'm tryng to connect it says me: ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it My server.py: import socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # allows reuse of the same port if the server script restarts serversocket.bind(('', 8089)) serversocket.listen(5) # become a server socket, maximum 5 connections while True: connection, address = serversocket.accept() try: buf = connection.recv(64) if buf: print (buf) finally: connection.close() My client.py import socket print("Client calling .....") socket_main = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socket_main.connect(('192.168.1.171', 8089)) message = 'Hello' socket_main.send(message.encode()) Any help? Thanks I've disabled the firewall but same problem. Continue reading...