当服务器重新启动并且客户端收到 WSAECONNRESET 错误代码时,我是否应该重新创建整个套接字

Should I recreate the whole socket when a server was rebooted and client received WSAECONNRESET error code

当服务器重新启动并且客户端在最后一次调用 send 函数时收到 WSAECONNRESET 错误代码时,我是否应该重新创建整个套接字?似乎我无法再次在同一个套接字上调用 connect 函数——它会一次又一次地失败并显示 WSAEISCONN 错误代码。我是否需要调用 closesocket 并使用 socket 函数再次创建 SOCKET

一旦套接字连接断开,您必须关闭 SOCKET 句柄并创建一个新句柄。唯一的例外是如果您使用 DisconnectEx() with the TF_REUSE_SOCKET flag, then the SOCKET can be reused with ConnectEx() or AcceptEx().