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