如何同时发送多个Web请求? [英] How to send multiple web requests simultaneously ?

查看:130
本文介绍了如何同时发送多个Web请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,



我将不同的段落保存为xml文件,我需要将它们发送到OpenCalais以获取文本的标签。一次发送一个文本需要花费很多时间。有没有办法可以同时发送多个文本并获取标签。任何多线程解决方案或什么?

解决方案

Javascript在单线程上运行。所以没有办法同时请求。相反,



您可以使用anync发送ajax请求:true。并为每个请求设置一个回调。



希望这会有所帮助。


看看这里:https://msdn.microsoft.com/en-us/library/hh696703.aspx [ ^ ]

也许在这里: www.itdevspace.com/2012/05/using-task-and-webrequest- to.html [ ^ ]

Greetings ,

I have different paragraphs saved as xml files and I need to send them to OpenCalais to get the tags for the texts. Sending the texts one at a time takes a lot of time. Is there a way I can send multiple texts at the same time and fetch the tags. Any Multithreaded solution or something ?

解决方案

Javascript runs on single thread. so there is no way to have simultaneous request. Rather,

you can send ajax requests with anync: true. and set a callback for each request.

hope this will help.


Take a look here: https://msdn.microsoft.com/en-us/library/hh696703.aspx[^]
And maybe here: www.itdevspace.com/2012/05/using-task-and-webrequest-to.html[^]


这篇关于如何同时发送多个Web请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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