'end' 事件


但是,如果 allowHalfOpen 设置为 true,套接字将不会自动将其可写端 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).