Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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)

by tye (Sage)
on Jul 26, 2016 at 16:16 UTC ( [id://1168574]=note: print w/replies, xml ) Need Help??


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:

  • You gave the wrong IP address
  • You gave the wrong port number
  • The service was not started
  • The service is only listening on some of the host's own IP addresses (most hosts only have 2 IP addresses, 127.0.0.1 and their other one, and a service can decide to only listen for connections sent to 127.0.0.1 or only to some other specific IP address -- this is actually a fairly common programming mistake when writing TCP service code).

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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1168574]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found