Code:
import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('172.0.0.1', 1234)) In this case, an error 111
Connection refused
With what it can be connected? Or how can I analyze the error to fix it?
Code:
import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('172.0.0.1', 1234)) In this case, an error 111
Connection refused
With what it can be connected? Or how can I analyze the error to fix it?
In general, the correct answer is really that no one is listening at the port.
But it is not listening, most likely due to the fact that the IP address is incorrect - it should be 127.0.0.1 for localhost (unlike 172.0.0.1 in your example)
In such cases, it makes sense to try to connect with third-party utilities (such as telnet) to check what the problem is - in python or in the port.
atlant@NewFarm:/$ telnet localhost 8888 Trying 127.0.0.1... Connected to localhost. Escape character is '^ 172.16.0.1 (rfc 1918) , 172.0.0.1 not a private address and therefore probably belongs to an external server. - jfsNobody is listening on the port. Therefore, there is nothing to connect.
Source: https://ru.stackoverflow.com/questions/590308/
All Articles