socket.resetAndDestroy()


通过发送 RST 数据包关闭 TCP 连接并销毁流。 如果此 TCP 套接字处于连接状态,则它会发送一个 RST 数据包,一旦连接就销毁此 TCP 套接字。 否则,它将使用 ERR_SOCKET_CLOSED 错误调用 socket.destroy。 如果此不是 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.