Posts

Showing posts from September, 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;

Creating .Net COM objects for interop with VB6

.Net has some nice tools to help you create COM objects. .Net COM objects are slightly different from regular that regular COM objects in that the .Net is still in its intermediate language form. Because of this, you cannot register a .Net COM object with "regsvr32" as usual, you must use "regasm", which comes with the .Net framework. There are a few project properties that in Visual Studio that will do a lot of the work for you. First, create a standard class library project, or open an existing one. Go to the project properties and change the following settings. On the "Application" tab, click the "Assembly Information" button. Check the box to "make assembly com-visible". This option will wrap your library as a COM library. Next go to the "Build" tab and check the box to "Register for COM interop". This option will automatically register the output dll with regasm on the current machine after a build. The final, o