Socket IO econnrefused on port 3000

Gavin Sellers

I'm running a node server using socket.io 0.9.16 and after restarting my server recently I got the above mentioned error:

{ [Error: connect ECONNREFUSED]
  stack: 'Error: connect ECONNREFUSED\n    at exports._errnoException (util.js:676:11)\n    at Object.afterConnect [as oncomplete] (net.js:938:19)\n    --------------------\n    at Protocol._enqueue (
/var/www/node_modules/mysql-activerecord/node_modules/mysql/lib/protocol/Protocol.js:110:48)\n    at Protocol.handshake (/var/www/node_modules/mysql-activerecord/node_modules/mysql/lib/protocol/Protoc
ol.js:42:41)\n    at Connection.connect (/var/www/node_modules/mysql-activerecord/node_modules/mysql/lib/Connection.js:98:18)\n    at Connection._implyConnect (/var/www/node_modules/mysql-activerecord
/node_modules/mysql/lib/Connection.js:296:10)\n    at Connection.query (/var/www/node_modules/mysql-activerecord/node_modules/mysql/lib/Connection.js:154:8)\n    at get (/var/www/node_modules/mysql-ac
tiverecord/index.js:387:15)\n    at Manager.<anonymous> (/var/www/mutual.js:101:71)\n    at Manager.authorize (/var/www/node_modules/socket.io/lib/manager.js:910:31)\n    at Manager.handleHandshake (/
var/www/node_modules/socket.io/lib/manager.js:786:8)\n    at Manager.handleRequest (/var/www/node_modules/socket.io/lib/manager.js:593:12)',
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  fatal: true }

nmap localhost returns:

Starting Nmap 5.21 ( http://nmap.org ) at 2014-07-22 21:02 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000050s latency).
Hostname localhost resolves to 2 IPs. Only scanned 127.0.0.1
rDNS record for 127.0.0.1: localhost.localdomain
Not shown: 992 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
53/tcp   open  domain
80/tcp   open  http
587/tcp  open  submission
3000/tcp open  ppp
3306/tcp open  mysql
9000/tcp open  cslistener

netstate -an | grep "LISTEN " returns

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN     
...

iptables --list returns

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3000

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Relevant server code:

var mysql = require('mysql-activerecord'),
    marked = require('marked'),
    conn = new mysql.Adapter({
            server: 'server-name',
            username: 'user',
            password: 'pass',
            database: 'database'
    }),
    moment = require('moment');

var io = require('socket.io').listen(3000);

Relevant client code:

a=io.connect("http://server-name:3000/",{query:stuff})

Thanks in advance for the help. Let me know if you need anymore information. Sorry if this post is a bit long.

mscdex

The ECONNREFUSED has nothing to do with socket.io, if you look at the backtrace provided in the error, you can see it's coming from the mysql module. So it appears that your mysql server is not listening on server-name on port 3306 (or at least something is blocking access to it).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Port hopping on IO::SOCKET::INET

From Dev

Port hopping on IO::SOCKET::INET

From Dev

ERR_CONNECTION_REFUSED http://localhost:3000/socket.io/socket.io.js

From Dev

Which port to use with socket.io?

From Dev

ECONNREFUSED on datagram Unix socket

From Dev

Socket.io client ignoring port when namespace used [Bug?]

From Dev

How do you run express and socket.io on the same port

From Dev

Sharing same port for REST endpoints and netty socket.io?

From Dev

Go & Socket.io HTTP + WSS on one port with CORS?

From Dev

How to configure Socket.io to run on same port on https?

From Dev

Node.js - Using Socket.io and Express on the Same Port

From Dev

Using node js library Socket io without port

From Dev

node.js+socket.io port not opening with ssl

From Dev

socket.io try to listen to default apache port

From Dev

socket.io port for every chat room javascript

From Dev

How to start node express, binaryserver and socket.io on same port?

From Dev

Vue - How to use a different socket.io port in tests?

From Dev

Run socket.io 2.0 and Express 4.0+ on the same port

From Dev

express app and socket.io chat in different port?

From Dev

Significance of port 3000 in Express apps

From Dev

Failed to connect to port 8080 error when using socket.io and node.js on openshift even when port 8000 specified

From Dev

How do I get my node/socket.io app to use the correct port when deployed to heroku?

From Dev

Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)

From Dev

Sails.js - how do I change what port Socket.io is using

From Dev

Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)

From Dev

How do I get my node/socket.io app to use the correct port when deployed to heroku?

From Dev

java.io.IOException: Unable to allocate socket for blob server in specified port range: 0

From Dev

Socket.io with Express, how does express app know what port to listen on?

From Dev

How to change the server port from 3000?

Related Related

  1. 1

    Port hopping on IO::SOCKET::INET

  2. 2

    Port hopping on IO::SOCKET::INET

  3. 3

    ERR_CONNECTION_REFUSED http://localhost:3000/socket.io/socket.io.js

  4. 4

    Which port to use with socket.io?

  5. 5

    ECONNREFUSED on datagram Unix socket

  6. 6

    Socket.io client ignoring port when namespace used [Bug?]

  7. 7

    How do you run express and socket.io on the same port

  8. 8

    Sharing same port for REST endpoints and netty socket.io?

  9. 9

    Go & Socket.io HTTP + WSS on one port with CORS?

  10. 10

    How to configure Socket.io to run on same port on https?

  11. 11

    Node.js - Using Socket.io and Express on the Same Port

  12. 12

    Using node js library Socket io without port

  13. 13

    node.js+socket.io port not opening with ssl

  14. 14

    socket.io try to listen to default apache port

  15. 15

    socket.io port for every chat room javascript

  16. 16

    How to start node express, binaryserver and socket.io on same port?

  17. 17

    Vue - How to use a different socket.io port in tests?

  18. 18

    Run socket.io 2.0 and Express 4.0+ on the same port

  19. 19

    express app and socket.io chat in different port?

  20. 20

    Significance of port 3000 in Express apps

  21. 21

    Failed to connect to port 8080 error when using socket.io and node.js on openshift even when port 8000 specified

  22. 22

    How do I get my node/socket.io app to use the correct port when deployed to heroku?

  23. 23

    Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)

  24. 24

    Sails.js - how do I change what port Socket.io is using

  25. 25

    Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL)

  26. 26

    How do I get my node/socket.io app to use the correct port when deployed to heroku?

  27. 27

    java.io.IOException: Unable to allocate socket for blob server in specified port range: 0

  28. 28

    Socket.io with Express, how does express app know what port to listen on?

  29. 29

    How to change the server port from 3000?

HotTag

Archive