server.close([callback])
callback<Function> 当服务器关闭时调用。- 返回值: <net.Server>
阻止服务器接受新的连接,并保持现有连接。此函数是异步的,当所有连接结束并且服务器触发 'close' 事件时,服务器最终关闭。可选的 callback 会在 'close' 事件发生后被调用。与该事件不同,如果服务器在关闭时未开启,它将以 Error 作为唯一参数被调用。
【Stops the server from accepting new connections and keeps existing
connections. This function is asynchronous, the server is finally closed
when all connections are ended and the server emits a 'close' event.
The optional callback will be called once the 'close' event occurs. Unlike
that event, it will be called with an Error as its only argument if the server
was not open when it was closed.】