socket.resetAndDestroy()
-
返回:<net.Socket>
¥Returns: <net.Socket>
通过发送 RST 数据包关闭 TCP 连接并销毁流。如果这个 TCP 套接字处于连接状态,它会发送一个 RST 数据包,并在连接后销毁这个 TCP 套接字。否则,它将调用 socket.destroy
并返回 ERR_SOCKET_CLOSED
错误。如果这不是 TCP 套接字(例如管道),调用此方法将立即抛出 ERR_INVALID_HANDLE_TYPE
错误。
¥Close the TCP connection by sending an RST packet and destroy the stream.
If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected.
Otherwise, it will call socket.destroy
with an ERR_SOCKET_CLOSED
Error.
If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an ERR_INVALID_HANDLE_TYPE
Error.