request.setTimeout(timeout[, callback])


当 socket 被分配给请求且已连接,则 socket.setTimeout() 会被调用。

  • timeout <number> Milliseconds before a request times out.
  • callback <Function> Optional function to be called when a timeout occurs. Same as binding to the 'timeout' event.
  • Returns: <http.ClientRequest>

Once a socket is assigned to this request and is connected socket.setTimeout() will be called.