When I try to run tcpServer and tcpClient on the same local network, it works, but I can't run them on the external network. The OS refuses the connection.
Main builtins.ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
I checked whether tcpServer is running or not using netstat, and it is in the listening state.
What am I supposed to do?
There are most likely two reasons for that:
1.) Your server application is not listening on that particular ip/port
2.) A firewall is blocking that ip/port
I would recommend checking your firewall settings. You could start with turning your firewall off to determine if it really is a firewall issue.
If so, just add an accept rule for your webservice (ip:port).
edit: And check your routing configuration if you are in a more or less complex network. Make sure that both networks can reach each other (e.g. ping the hosts or try to connect via telnet).
Related
What exactly does this error mean and how can i fix it, am running server on port 8000 of local host.
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
Is firewall running on the server? If so, that may be blocking connections. You could disable firewall or add an exception on the server side to allow connections on port 8000.
I needed to set my default VS-Code internal terminal profile to Command Prompt:
For more details, please refer to this full answer.
A robot is connected to a network with restricted outbound traffic. Only inbound traffic is allowed from one specific IP address(ours IP, e.g. 111.111.111.111). All outgoing traffic is forbidden.
There is settings and dhcp corresponding to external IP(e.g. 222.222.222.222). We want to connect to Pepper from the IP 111.111.111.111. The connection through SSH is fine with ssh nao#222.222.222.222 and password but we can not connect through Choregraphe or Python scripts. This is very important because we want to be able to connect with the robot remotely to upload different Choregraphe applications.
This is the error when we are trying to connect with a Python script:
[W] 18872 qimessaging.transportsocket: connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
...
RuntimeError: Failed to connect to service ALBehaviorManager on machine 1296211e-1921-3131-909b-69afa37ааа28. All endpoints are unavailable.
The Choregraphe hangs and crashes after a certain period of time.
Can you give me some advice?
NAOqi connections go through port 9559 by default, so you could check whether that one is blocked.
If you are unable to connect through port 9559, you can do a port forwarding. But I think this is a more network related question.
PyCharm remote debugging (pydevd) does not connect with the following message:
error: [Errno 10061] No connection could be made because the target machine actively refused it
How can I troubleshoot it?
The output console in PyCharm shows:
Starting debug server at port 21000
Use the following code to connect to the debugger:
import pydevd
pydevd.settrace('*.*.*.*', port=21000, suspend=False)
Waiting for process connection...
Server stopped.
I checked the firewall and PyCharm is allowed for both incoming and outgoing connections.
10061 is WSAECONNREFUSED, 'connection refused', which means there was nothing listening at the IP:port you tried to connect to.
Though I see that you have validated its not a firewall issue, but still I would suggest to check the port numbers again with respect to the ones opened in windows firewall. Or to narrow down just run a simplehttpserver or icmp server at the same port and confirm.
In a direct link communication, it often means that you have already something connected to this port.
To check what process is hearing what port, check this SO question.
You can then either kill the program or change the port, depending of what you can do.
Without more information of the "remote tested", it is hard to know what is happening.
I was having the trouble as well (Server stopped as soon as the client connected).
Turned out that I had apparently too many breakpoints defined.
after having removed most of them and re-initiated my remote debug connection from the client (and having restarted the debug server in pycharm) it doesn't trigger anymore the "Server stopped." problem.
I am learning python socket programming. Everything works fine if I run locally (both server and client scripts). However, when I moved the server script to a VM (Ubuntu 14.04) and run the client script from the host os (Windows 7) I got this error:
ConnectionRefusedError: [WinError 10061] No connection could be made because the
target machine actively refused it
When I tried running the client inside the VM, it works just fine (except if I use the IP address i.e:192.168.1.6, I have to use it in both scripts). From my search, I found that linux does not activate the firewall by default. What did I do wrong?
Both machines can see each other ( i have set Samba between them, can ping others etc). This is really confusing for me.
Probably this may solve the problem.
You have a bind call in your server code, it looks like sock.bind(('127.0.0.1', 3333)), where 3333 is the server port number. Change the IP address to the empty string, or '0.0.0.0', so it would look like sock.bind(('', 3333)). Then start the client again.
The original bind call binds the server socket only to the loopback interface (lo), which works only within the VM. By binding to the wildcard address ('' or '0.0.0.0') the server will accept connections from any IP address.
For example, if I have my minecraft server running on port 25565, I want to have a python script close the port so that all connections will be dropped and no further connections will be made without having to shutdown the service.
I have tried binding a new socket to the same port number and then closing the socket, but it does not have any effect on the server.
I am working in Python 3.3.
Use a firewall for example?
On linux there is the iptables. It's easy to use and powerful.