質問

I have a basic node.js app that is designed to open up a connection between two clients and echo the input of one to the other.

var net = require("net");
console.log("Relay Started");
var id = 0;
var Socket = [];
relay = net.createServer(function(socket) {
        socket.on('connect', function() {
                console.log('Connected');
                if(socket.id==null) {
                        socket.id = id;
                        Socket[id]=socket;
                        id++;
                }
        });
        socket.on('data', function(data) {
            data = data.toString()
            if (socket.id==0) {
                    Socket[1].write(data);
            } else if (socket.id==1) {
                    Socket[0].write(data);
            }
            console.log(socket);
            console.log(data.toString());
    });

})
relay.listen(process.env['app_port']||8080);

It works fine when run locally, however when I put it onto a Nodester development server, I am unable to connect by using telnet zapcs.nodester.com 18007 (it is hosted under the name zapcs, and the given port is 18007). The Relay Started is logged, but nothing after that, and no connection. Any ideas on why this would be?

~

役に立ちましたか?

解決

you can not telnet zapcs.nodester.com 18007, you only can connect to zapcs.nodester.com:80 by http or websock, nodester will route your request to your app actual port (18007) on the host.

And check this: http://www.slideshare.net/cmatthieu/nodester-architecture-overview-roadmap-9382423

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top