Not by default.
So, what is Req.settimeout (msec, callback) for?
It means that the socket msec is not active after executing callback and does not help you close the connection.
Like a stopwatch, every time you receive data, start from the beginning, metaphorically: "I haven't heard from you for a while."
Hint: The client is not self-contained timeout (need to implement), the server has, the following summarizes the HTTP module in node timeout.
Four timeouts for HTTP (both of which are service-side)
1. Default 2 minutes
2. server.timeout = 120000;
3. Res.on (' timeout ', callback)
4. Req.settimeout (Msecs, callback)
They differ from the following
In the case of HTTP default timeout (2 minutes), if this request is
Up, i.e. no res.end (), then the server triggers req.aborted req.close
Res.close event, close the connection.
However, if Res.on (' timeout ', callback) is registered, after 2 minutes, HTTP executes a timeout callback function, and nothing else is done.
If Req.settimeout is registered (msecs,
callback), then HTTP executes the callback function after the Msecs timeout, and nothing else is done.
If Res.on (' timeout ', callback) and Req.settimeout (Msecs, callback) are registered at the same time, the two callback functions are executed separately, and nothing else is done.
If you only set a smaller server.timeout variable, the timeout behavior is the same as the default, or it will trigger res.aborted
Req.close Res.close, close the connection-just shorten the time-out.
Note: node version v0.12.0
Nodejs-http.request If there is a timeout