Thursday, December 6, 2007

CodeProject: A high performance TCP/IP socket server COM component for VB

CodeProject: A high performance TCP/IP socket server COM component for VB
Although socket based TCP/IP servers using IO Completion Ports are often written in C++ it's sometimes useful to write such a server in Visual Basic.

The following source was built using Visual Studio 6.0 SP5 and Visual Studio .Net. You need to have a version of the Microsoft Platform SDK installed

Although socket based TCP/IP servers using IO Completion Ports are often written in C++ it's sometimes useful to write such a server in Visual Basic. You can use the Winsock control for this, but it deals with the Windows Sockets interface at a very low level and you have to write lots of VB code. This article presents a simple COM object that wraps the high performance socket server framework that we developed in previous articles. The COM object provides a simple, yet powerful, interface that allows you to easily construct high performance TCP/IP servers with a minimal amount of VB code.

The article presents the Socket Server COM object and a simple sample VB server application and describes how you use the COM object. The next article will deal with how the COM object was constructed and the design decisions and coding of the object itself. Please note that this object can only be used on Windows NT/2000/XP.

A high performance TCP/IP Socket Server COM object

The socket server COM object provides a factory object for creating TCP/IP socket servers. The factory object is marked as an appobject so you can use it without an explicit reference as in the following example:

....