Ok, I removed the callback. I don't understand what's `NODE_DEBUG="net http" node script.js` and how to use it, but I've discovered why the server was not responding. Now the communication is happening, but still even if I put a SOCKET_TIMEOUT of 1000000 (1000 seconds, 16 minutes more or less) after 8 minutes I start getting errors like "problem with request: socket hang up" (from the println in the request) and "problem with request: connect ETIMEDOUT". Any clue on what's going on? Thanks
On Mar 30, 2:56 pm, Ben Noordhuis <[email protected]> wrote: > On Fri, Mar 30, 2012 at 14:28, Masiar <[email protected]> wrote: > > Just tried. It seems like it doesn't even start the connection (I'm > > trying to connect it to another nodejs server, and the other server is > > not logging any connection to it). This is the code: > > > var options = { > > some: 'option', > > }; > > > var req = http.request(options, function(res) { > > res.setEncoding('utf8'); > > > res.on('data', function (chunk) { > > //do something with chunk > > }); > > }); > > > req.on('error', function(e) { > > console.log('problem with request: ' + e.message); > > }); > > > req.setTimeout(SOCKET_TIMEOUT, function(socket){}); > > > req.write('data\n'); > > req.end(); > > > Is there something wrong? > > I don't see anything obviously wrong. What does `NODE_DEBUG="net http" > node script.js` print? .setTimeout() doesn't take a callback by the > way. -- 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
