socket.resetAndDestroy()


通过发送 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.】