'end' 事件
当套接字的另一端表示传输结束时触发,从而结束套接字的可读端。
默认情况下(allowHalfOpen
是 false
)套接字将发送传输结束数据包,并在写出其挂起的写入队列后销毁其文件描述符。
但是,如果 allowHalfOpen
设置为 true
,套接字将不会自动将其可写端 end()
,从而允许用户写入任意数量的数据。
用户必须显式调用 end()
来关闭连接(即发回一个 FIN 数据包)。
Emitted when the other end of the socket signals the end of transmission, thus ending the readable side of the socket.
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).