0

Port is open and listening but is denying connections.

When trying to CURL in terminal

curl --data-binary '{"id":"curltext","method":"addrequest","params":{"amount":"3.14","memo":"test"}}' http://user:pass@127.0.0.1:7777

Error Message

curl: (7) Failed to connect to 127.0.0.1 port 7777: Connection refused

Below are my netstats. Port is open and listening.

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:7777          0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN           

The command

curl -v 127.0.0.1 7777

Returns:

Rebuilt URL to: 127.0.0.1/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.55.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Wed, 04 Apr 2018 18:22:14 GMT
< Server: Apache/2.4.29 (Fedora)
< X-Powered-By: PHP/7.1.15
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
< 

/*index.php code*/

* Connection #0 to host 127.0.0.1 left intact
* Rebuilt URL to: 7777/
*   Trying 0.0.30.97...
* TCP_NODELAY set
* Immediate connect fail for 0.0.30.97: Invalid argument
* Closing connection 1
curl: (7) Couldn't connect to server

linux Fedora 27 Apache 2.4 Electrum 3.1.2

  • Is your firewall on? – Spooler Apr 4 '18 at 18:31
  • Possible. IP tables not installed. systemctl disable firewalld returns: Failed to disable unit: Unit file firewalld.service does not exist. – seamus Apr 4 '18 at 18:33
  • You cannot use curl with the latter invocation method to an HTTP request to 127.0.0.1 port 7777. As you can see from the output, it tries to connect first to 127.0.0.1 port 80 and then to 0.0.30.97, which is an IP address converted from 7777. Now, in order to answer the actual question, you need to provide information what exactly is running at port 7777. Also, the first curl command verbose (-v) output is useful. – Tero Kilkanen Apr 4 '18 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.