Jan-13-2025, 08:25 AM
Hi,
I'm trying to create a socket with python:
Mi server.py:
My client:
I have disabled the firewall, but it says me:
Any help? Thanks
I'm trying to create a socket with python:
Mi server.py:
1 2 3 4 5 6 7 8 9 10 11 12 |
import socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.bind(('', 8089 )) serversocket.listen( 5 ) # become a server socket, maximum 5 connections while True : connection, address = serversocket.accept() buf = connection.recv( 64 ) if len (buf) > 0 : print (buf) break |
1 2 3 4 5 6 7 8 9 10 |
import socket print ( "Client calling ....." ) socket_main = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socket_main.connect(( '192.168.1.171' , 8089 )) while True : message = 'Hello' socket_main.send(message.encode()) |
1 2 3 4 |
Traceback (most recent call last): File "C:\script\client.py" , line 6 , in <module> socket_main.connect(( '192.168.1.171' , 8089 )) ConnectionRefusedError: [WinError 10061 ] No connection could be made because the target machine actively refused it |