September 18, 2008

HTTP Connection Limit in .Net

There exists a web specification which suggests a server endpoint only allow up to two connections from any client at a time. The .Net Framework builds this limit in by default. This means that if you are trying to use HTTPWebRequest, WebRequest, etc, and attempt to maintain more than two connections at a time, it simply will not work. There is a rare case where a client application would require more than two maintained connections, though we found one in trying to watch more than two camera feeds from a video server. You can get around this limitation by changing the default connection limit like so:

System.Net.ServicePointManger.DefaultConnectionLimit = 4;

No comments: