处理间歇性 Winsock 错误
我的客户端应用程序针对我们与之交互的一台特定服务器出现间歇性的 winsock 错误(10060、10053)。我让它重试失败的请求,但有时会反复失败,重试 5 次后我就放弃了。如果我关闭套接字并创建一个新套接字,可能会有帮助吗? (我对服务器端一无所知。)
My client app gets intermittent winsock errors (10060, 10053) against one particular server we interface with. I have it re-trying the request that failed, but sometimes it fails repeatedly, and I give up after 5 re-tries. Would it be likely to help at all if I closed the socket and created a new one? (I know nothing about the server-side.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,所以您收到的错误是:
您什么时候收到它们?你此时在做什么?
当连接的远程端(或者可能是中间路由器)重置连接并发送 RST 时,您会收到
WSAECONNABORTED
。这可能只是远程端发出非延迟关闭,也可能是远程端中止或崩溃。您无法继续对带有
WSAECONNABORTED
的连接执行任何操作,因为该连接已中止并且不再存在;它是一个死连接,它已经传递了...对于为什么您可能会收到 WSAETIMEDOUT 异常,上下文非常重要,并且上下文将决定重试是否明智。
Ok, so the errors that you're getting are:
When do you get them? What are you doing at the time?
You get a
WSAECONNABORTED
when the remote end of the connection, or possibly an intermediary router, resets the connection and sends an RST. This could simply be the remote end issuing a non lingering close or it could be the remote end aborting or crashing.You can't continue doing anything with a connection that has had a
WSAECONNABORTED
on it as the connection has been aborted and is no more; it is a dead connection, it has passed on...Context matters immensely as to why you might get a
WSAETIMEDOUT
exception and the context will dictate if retrying is sensible or not.我会尝试的一件事是 - 对您的服务器进行跟踪。
通常当某人通过 VPN 连接时;您可能会看到此错误,因为您的本地和远程 IP 地址重叠。
例如,如果您的本地 IP 地址范围是 192.168.1.xxx,并且 VPN 远程范围也是 192.168.1.xxx,您也会看到此错误。
沙拉杰什
One thing I would try is- do tracert to your server.
Often when someone is connected through VPN; you may see this error because your local and remote ip addresses overlap.
e.g. if your local ipaddress range is 192.168.1.xxx and vpn remote range is also 192.168.1.xxx you will also see this error.
sharrajesh