'end' 事件


当 socket 的另一端发送一个 FIN 包的时候触发,从而结束 socket 的可读端。

默认情况下(allowHalfOpenfalse),socket 将发送一个 FIN 数据包,并且一旦写出它的等待写入队列就销毁它的文件描述符。当然,如果 allowHalfOpen 为 true,socket 就不会自动结束 end() 它的写入端,允许用户写入任意数量的数据。用户必须调用 end() 显示地结束这个连接(例如发送一个 FIN 数据包。)

Emitted when the other end of the socket sends a FIN packet, thus ending the readable side of the socket.

By default (allowHalfOpen is false) the socket will send a FIN 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).