如何模拟挂起的 Web 服务?

发布于 2024-07-14 19:57:23 字数 259 浏览 4 评论 0原文

我正在尝试测试与 Web 服务交互的软件的故障模式,并且我已经报告了如果软件没有得到及时响应(例如,等待一分钟或更长时间)就会出现问题的问题。 我想模拟这个,以便我可以自己跟踪并解决问题,但拔掉网络连接并不能解决问题,因为它会立即返回,但找不到路由。

我想知道的是,有没有一种简单的方法可以制作一个 CGI 脚本,该脚本接受连接但只是坐在那里,使连接保持活动状态几分钟,而不需要执行 while (true) {}< /code> 循环类型?

I'm trying to test out modes of failure for software that interacts with a web service, and I've already had reported issues where problems occur if the software doesn't get a timely response (e.g., it's waiting a minute or longer). I'd like to simulate this so that I can track down and fix issues myself, but unplugging the network connection doesn't do the trick, because it returns immediately with no route found.

What I'd like to know is, is there a simple way I can make a CGI script that accepts a connection but just sits there, keeping the connection alive for several minutes, without doing a while (true) {} type of loop?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

§普罗旺斯的薰衣草 2024-07-21 19:57:23

让脚本休眠一段(很长)时间怎么样?

How about letting the script sleep for some (very long) time?

捎一片雪花 2024-07-21 19:57:23

我不知道你的脚本使用什么语言,但在.net中你可以做类似的事情 Thread.Sleep(6000);

I don't know what language you are using for your scripting, but in .net you could do something like Thread.Sleep(6000);

白馒头 2024-07-21 19:57:23

HTTP Fiddler 非常适合此类事情。 您可以模拟慢速连接,如果您愿意,可以在请求传入时使其“中断”,以便您可以模拟永远不会返回的响应。

去这里拿吧...
http://www.fiddlertool.com/fiddler/

HTTP Fiddler is excellent for this sort of thing. You can simulate slow connections and, if you want, get it to "break" when a request comes in so you can similate a response that never returns.

Go get it from here...
http://www.fiddlertool.com/fiddler/

攀登最高峰 2024-07-21 19:57:23

您必须以某种方式闲置,因为如果您的 CGI 脚本返回,连接将关闭。

如果您的网络设备支持限制,您可能希望将传出流量限制在极低的水平。

You will have to idle in some way since if your CGI script returns the connection will get closed.

If your network equipment supports throttling you might want to limit outgoing traffic to something ridiculously low.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文