server.setTimeout([msecs][, callback])
msecs
<number> 默认值: 0(无超时)callback
<Function>- 返回: <http.Server>
设置套接字的超时值,并在服务器对象上触发 'timeout'
事件,如果发生超时,则将套接字作为参数传入。
如果 Server 对象上有 'timeout'
事件监听器,则将使用超时套接字作为参数调用它。
默认情况下,服务器不会超时套接字。
但是,如果将回调分配给服务器的 'timeout'
事件,则必须显式处理超时。
msecs
<number> Default: 0 (no timeout)callback
<Function>- Returns: <http.Server>
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.
If there is a 'timeout'
event listener on the Server object, then it
will be called with the timed-out socket as an argument.
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.