Chapter 15 -- The Microsoft Visual Basic Winsock Control

Chapter 15

This chapter describes the Visual Basic Winsock control, a relatively new control whose purpose is to simplify the Winsock interface into an easy-to-use interface natively available from Visual Basic. Before the control was available, the only option for Winsock network programming from Visual Basic was to import all the Winsock functions from the DLL and redefine the necessary structures, which are many. This process was extremely time-consuming and prone to numerous errors, such as mismatching the type declarations. However, if you need the extra flexibility offered by directly importing Winsock into Visual Basic, take a look at the Visual Basic examples that are available throughout Part II of this book. Each Visual Basic example contains a file, Winsock.bas, that imports the necessary constants and functions. This chapter focuses only on the Visual Basic Winsock control. We'll first cover the properties and methods of the control and then present several examples that use the control.

The first Winsock control was introduced with Visual Basic 5.0. A revised version of the control became available with the Visual Studio Service Pack 2. A Service Pack 3 released later did not change the control from the SP2 version. Visual Basic 6.0 includes the latest version of the Winsock control. The various version differences are discussed toward the end of this chapter.

The Winsock control provides only a basic interface to the Winsock APIs. Unlike Winsock, which is a protocol-independent interface, the Winsock control can use only the IP transport. Additionally, the control is based on the Winsock 1.1 specification. The control supports both TCP and UDP, but in a rather limited sense. The control itself is not able to access any socket options, which means that features such as multicasting and broadcasting aren't available. Basically, the Winsock control is useful only if you require basic data networking capabilities. It does not provide the best performance because it buffers data within the control before it passes it to the system, thus adding a bit of overhead and uncertainty.



Network Programming for Microsoft Windows
Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting
ISBN: 735615799
EAN: 2147483647
Year: 1998
Pages: 159

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net