简体   繁体   English

使用HttpWebRequest时一次可以打开多少个并发连接?

[英]How many concurrent connections can I have open at one time when using HttpWebRequest?

I am using asynchronous HttpWebRequest BeginGetResponse calls; 我正在使用异步HttpWebRequest BeginGetResponse调用; the docs say that not closing the stream in the callback may result in running out of connections. 文档说未在回调中关闭流可能导致连接用尽。

How many connections can I have before "running out"? “用尽”之前可以有多少个连接? I am using .NET 3.5. 我正在使用.NET 3.5。

Also, is there a socket connection pool in the CLR. 另外,CLR中是否有套接字连接池。 If so, where is this documented? 如果是这样,该文件记录在哪里?

How many? 多少? Depends on a lot of things; 取决于很多事情; sockets share the I/O thread pool with all the other asynch I/O mechanisms. 套接字与所有其他异步I / O机制共享I / O线程池。

A short if unhelpful answer is "lots". 一个简短而无用的答案是“很多”。 Unless you are creating a server of some sort you are highly unlikely to run out. 除非要创建某种服务器,否则极不可能用完。

There isn't a socket connection pool as such, but there is an asynch I/O thread pool as you may have gleaned from the above. 没有这样的套接字连接池,但是您可能已经从上面收集到了一个异步I / O线程池。 You may find instructive this blog post from Eric Eilebrecht , whereas a following post is about what happens next . 您可能会从Eric Eilebrecht那里找到具有启发性的博客文章 ,而接下来的文章是有关接下来发生的事情

What you may not realise is that your router will play a big part in this. 您可能没有意识到,路由器将在其中扮演重要角色。 (And of course memory, internet connection speed etc.) It would be interesting to know what the theoretical maximum would be... Depending on your OS, you may need to do some tweaks to allow many connections. (当然还有内存,Internet连接速度等。)知道理论上的最大值是很有趣的……根据您的操作系统,可能需要做一些调整以允许许多连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用HttpWebRequest发布数据? - How can I Post data using HttpWebRequest? 使用c#一次接受多个tcp连接 - Accepting many tcp connections at one time using c# 为什么我收到超时异常,使用httpwebrequest下载文件时应如何处理? - Why i'm getting time out exception and how should i handle this when using httpwebrequest to download a file? 我如何一次打开两个连接以在C#中同步两个数据库mysql? - How I can have two connections open at once to synchronize two databases mysql in c#? 如何随时使用带有并发连接的c#编写TCP Server - How to write a TCP Server, using c# with concurrent connections at any time 使用HttpWebRequest时如何防止UI冻结? - How can I prevent UI freezing while using HttpWebRequest? 更新并发连接上的活动时间 - Update activity time on concurrent connections 如何在c#.net核心项目中测试我的代码一次打开的请求连接数不超过50个? - How can I test that my code does not open more than 50 request connections at a time in my c# .net core project? 在许多异步请求期间实际上有多少个同时(并发)连接处于活动状态 - How many simultaneous (concurrent) connections are actually active during a many async request 我可以拥有多少个命名管道? - How many named pipes can I have?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM