server.setTimeout([msecs][, callback])
msecs<number> 默认值: 0(无限超时)callback<Function>- 返回值:<http.Server>
为套接字设置超时时间,如果发生超时,会在 Server 对象上触发 'timeout' 事件,并将套接字作为参数传递。
【Sets the timeout value for sockets, and emits a 'timeout' event on
the Server object, passing the socket as an argument, if a timeout
occurs.】
如果 Server 对象上存在 'timeout' 事件监听器,那么它将使用超时的套接字作为参数被调用。
【If there is a 'timeout' event listener on the Server object, then it
will be called with the timed-out socket as an argument.】
默认情况下,服务器不会对套接字进行超时处理。但是,如果为服务器的 'timeout' 事件分配了回调,则必须显式处理超时。
【By default, the Server does not timeout sockets. However, if a callback
is assigned to the Server's 'timeout' event, timeouts must be handled
explicitly.】