[英]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.