事件:'end'


【Event: 'end'

当套接字另一端发出传输结束信号时触发,从而结束套接字的可读端。

【Emitted when the other end of the socket signals the end of transmission, thus ending the readable side of the socket.】

默认情况下(allowHalfOpenfalse),套接字在写出其挂起的写入队列后,会发送一个传输结束包并销毁其文件描述符。然而,如果 allowHalfOpen 设置为 true,套接字将不会自动关闭其可写端,允许用户写入任意数量的数据。用户必须显式调用 end() 来关闭连接(即发送一个 FIN 包)。

【By default (allowHalfOpen is false) the socket will send an end of transmission packet back and destroy its file descriptor once it has written out its pending write queue. However, if allowHalfOpen is set to true, the socket will not automatically end() its writable side, allowing the user to write arbitrary amounts of data. The user must call end() explicitly to close the connection (i.e. sending a FIN packet back).】