node.js server wont listen to the port or server blocks the connections to this port

238 views Asked by At

I have a real time chat in my project, The project is base on Laravel and the chat is with node.js and socket.io. I have a problem with connecting to the port that my node.js server file open my server file codes is:

var express = require("express"), http = require('http');
var app = express();
var server = http.createServer(app);
// var io = require('socket.io')(server);
var io = require('socket.io').listen(server);
server.listen(52437);

console.log("executed");

io.on('connection', function (socket) {
    console.log("connnnnnnnnnnnnnnnnnnnnnnnnnnnnnectedddddddddddd");
});

this codes in in a file in directory public_html/build/js/server.js with permition 755. When I run this command in shell on server:

node public_html/build/js/server.js

the console.log('execute') will execute and "executed" will print in shell so the file exists and node server will run am I right?

This node server is listening to port 52437 so it should be an open port right? but when I try this command from my terminal:

telnet [domain or IP] 57329

After 5 to 10 second it return a connection time out. Can someone help me What is wrong?

Thanks.

0

There are 0 answers