I have this code:
>>> import socket
>>> sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sck.connect(('loaclhost', 2525))
And I have this error:
Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> sck.connect(('localhost', 2526)) socket.error: [Errno 10061] No connection could be made becausethe target machine actively refused it
Please helpe me. Where can be error? How can I repair it?
Your code and error don’t match (spelling of localhost and port number), but the error message is due to no server listening on that port. Cut and paste the exact code and error message next time.