人为创建连接超时错误 [英] Artificially create a connection timeout error

查看:138
本文介绍了人为创建连接超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我们的软件中遇到了一个错误,当我收到连接超时时发生。这些错误是非常罕见的(通常当我的连接被我们的内部网络丢弃)。我如何人为地生成这种效果,所以我可以测试我们的软件?

I've had a bug in our software that occurs when I receive a connection timeout. These errors are very rare (usually when my connection gets dropped by our internal network). How can I generate this kind of effect artificially so I can test our software?

如果有问题,应用程序是使用CAsyncSocket类在C ++ / MFC中编写的。

If it matters the app is written in C++/MFC using CAsyncSocket classes.

我尝试使用不存在的主机,我收到套接字错误:

I've tried using a non-existant host, and I get the socket error:

WSAEINVAL(10022)参数无效

WSAEINVAL (10022) Invalid argument

我的下一次尝试是使用 Alexander 建议连接到不同的端口,例如81(在我自己的服务器上)。这工作很好。与丢弃的连接完全相同(60秒等待,然后错误)。谢谢!

My next attempt was to use Alexander's suggestion of connecting to a different port, e.g. 81 (on my own server though). That worked great. Exactly the same as a dropped connection (60 second wait, then error). Thank you!

推荐答案

连接到现有主机,但连接到被防火墙阻止的端口,只是丢弃TCP SYN数据包。例如,www.google.com:81。

Connect to an existing host but to a port that is blocked by the firewall that simply drops TCP SYN packets. For example, www.google.com:81.

这篇关于人为创建连接超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆