On Fri, Oct 19, 2012 at 2:07 PM, Michael <[email protected]> wrote: > hi, we have some problems with http requests in node. We switched from the > module restler to request but the error still occurs and it seems to be a > node problem, not a problem of the module. > > code: > var options = { > method: "GET", > uri: "http://192.168.71.30:8080/api", > json: true > }; > var timeout = setTimeout(function() { > console.log("slow request"); > }, 5000); > var begin = new Date(); > request(options, function(error, response, body) { > var end = new Date(); > clearTimeout(timeout); > if (error) { > console.log("error in request"); > } else { > console.log("fast request"); > } > }); > > The phenomena: > > A healthy request looks like this in strace -e trace=network -v -p [pid]: > connect(26, {sa_family=AF_INET, sin_port=htons(8080), > sin_addr=inet_addr("192.168.71.30")}, 16) = -1 EINPROGRESS (Operation now in > progress) > getsockopt(26, SOL_SOCKET, SO_ERROR, [175508375352639488], [4]) = 0 > > A boken request does not appear at all in strace and a "slow request" is > logged. > > > So my question: Why does node do not open a socket
It did, fd 26. > and does not throw an error? EINPROGRESS is not a real error, it just means that the connection hasn't been fully established yet. -- 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
