unexpected error and stop node js

28 views
Skip to first unread message

VR76

unread,
Jun 6, 2017, 9:50:56 AM6/6/17
to nodejs
hi
my node js program listen to port 8000. it's going right but when c# program connect to server and after connect and before recive data . if c# detect connect from server the node js crash and give error
the error refered to file net line 883
this line
req.address = address;

Lucas Oliveira

unread,
Jun 7, 2017, 12:31:35 AM6/7/17
to nodejs
Maybe the problem is with this req, it should be request instead of only req. This problem happens with a lot of people beginning with Node.js. The problem with putting variable names like these, it's exactly this, they evently will crash or happen some error that you didn't expected.

VR76

unread,
Jun 9, 2017, 2:06:42 AM6/9/17
to nodejs
thank's for answer
i put all socket in object with user id key
for example if user id is 3
sockets_ob[3] = socket
and when administrator need send data for user 3 use sockets_ob[3]
how change this to program  works right ?

VR76

unread,
Jun 9, 2017, 7:43:29 PM6/9/17
to nodejs
i run this code and if c# program open port and didn't recieve data node js crash !!!
var net = require('net');

var server = net.createServer(function(socket) {
socket.write('Echo server\r\n');
socket.pipe(socket);
});

server.listen(8000, '127.0.0.1');
Reply all
Reply to author
Forward
0 new messages