I'm testing a server and I need to keep alive some connection as long
as possible. I would like to set by hand the timeout of http.request()
function. This is what I do in my code.
var req = http.request(options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
//do something with chunk
});
});
I tried something like req.on('socket' function(socket)
{ socket.setTimeout(SOCKET_TIMEOUT); }); but it gives me some strange
errors and I think it's not the right way to do it. For your info the
error I get using that approach is the following
Trace:
at Socket.<anonymous> (events.js:133:17)
at ClientRequest.<anonymous> (/home/babazadm/REST-TCC/
TestingServer/server_nologs.js:168:10)
at ClientRequest.emit (events.js:88:20)
at Array.1 (http.js:1250:9)
at EventEmitter._tickCallback (node.js:192:40)
(node) warning: possible EventEmitter memory leak detected. 11
listeners added. Use emitter.setMaxListeners() to increase limit.
Which is kinda cryptic to me. Can someone explain me how to set the
timeout? Otherwise, if my approach is correct, how can I avoid getting
that error?
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en