http://qs321.pair.com?node_id=1168574


in reply to Error in HTTPS connection with error: No connection could be made because the target machine actively refused it. at C:/Perl/lib/LWP/Protocol/http.pm line 47

"Connection refused" means that the host at the specified IP address was successfully reached but that no service was registered to listen on the port number that you specified.1

So there are really only a very few reasons that you could get that error:

Looking at "netstat -a" on the service's host (if it is running Unix or Windows, at least) would tell you what ports are being listened to for which addresses. If you are on Unix, then you can use "sudo netstat -ap" to even see which process is listening on each port (on Windows you would use "netstat -ab" in a cmd prompt with elevated privileges).

See also connect. The entry for ECONNREFUSED is quite short there but is accurate and would have been a very good clue.

1 Or, quite rarely, it can be that a TCP service is listening on that port number and is not using the 'socket' library (which is, by far, the most commonly used library) to accept requests at that port number. In such a case, it is possible for the service to examine information in the first part of the TCP handshake (usually the source IP address, that is, the client's IP address) and reject the request in the same way that the TCP stack will reject a request for an unlistened to port number.

- tye        

  • Comment on Re: Error in HTTPS connection with error: No connection could be made because the target machine actively refused it. at C:/Perl/lib/LWP/Protocol/http.pm line 47 (ECONNREFUSED)