同步发送请求

发布于 2024-09-14 00:47:51 字数 147 浏览 2 评论 0原文

嘿,我在做什么,我必须向雅虎发送请求以获取股票价格。我需要发送的公司名称位于一个数组中,ni 也编码为仅发送 100 个公司请求,但发生的情况是请求一次全部发送,并且由于它不等待响应,因此我仅收到前 100 个公司的响应.如何同步发送请求?还有像锁之类的东西可以用来做到这一点吗?

Hey what i m doing i have to send requests to yahoo for picking up the stock rates. The companies name which i need to send are in an array n i have also coded to send only 100 companies request but what happens is the requests are sending all at a time and since it doesnt wait for the response i get response only for the first 100. how to synchronize sending requests?? Also is there sumthing like a lock which can be used to do it.??

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

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

发布评论

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

评论(1

星光不落少年眉 2024-09-21 00:47:51

您需要维护一个队列,其中所有请求一次或在不同时间插入...队列将获取请求执行它并在获得响应后将其从队列中删除。这个循环继续直到队列变空......

you need to maintain a queue in which all request are inserted at once or in different time... Queue will fetch request execute it and remove it from queue after getting response. and this cycle continue till queue gets empty...

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