Catalyst Development An Introduction to TCP/IP Programming
PreviousNext
  
1. Introduction
  
With the acceptance of TCP/IP as a standard platform-independent network protocol, and the explosive growth of the Internet, the Windows Sockets API (application program interface) has emerged as the standard for network programming in the Windows environment. This document will introduce the basic concepts behind Windows Sockets programming and get you started with your first application. If you're already familiar with sockets programming, feel free to skip this section. It is assumed that the reader is familiar with Visual Basic and has installed the SocketWrench custom control.

The Windows Sockets specification was created by a group of companies, including Microsoft, in an effort to standardize the TCP/IP suite of protocols under Windows. Prior to Windows Sockets, each vendor developed their own proprietary libraries, and although they all had similar functionality, the differences were significant enough to cause problems for the software developers that used them. The biggest limitation was that, upon choosing to develop against a specific vendor's library, the developer was "locked" into that particular implementation. A program written against one vendor's product would not work with another's. Windows Sockets was offered as a solution, leaving developers and their end-users free to choose any vendor's implementation with the assurance that the product will continue to work. 

There are two general approaches that you can take when creating a Visual Basic program that uses Windows Sockets: code directly against the API, or use a custom control (VBX) which provides an interface to the library by setting properties and responding to events. The first approach, while possible, is not recommended. The Windows Sockets API was designed for use by C programmers, and some of the functions are fairly unpleasant to use in the Visual Basic environment. You'll end up writing a great deal of code geared towards working around the incompatibilities between the API and Visual Basic, rather than writing the code for your application. 

A custom control provides a more "natural" programming interface, and allows you to avoid much of the error-prone drudgery commonly associated with sockets programming. By dropping the control on a form, setting some properties and responding to events, you can quickly and easily write an Internet-enabled application. And because of the nature of custom controls in general, the learning curve is low and experimentation is easy. SocketWrench provides a comprehensive interface to the Windows Sockets library and will be used to build a simple client-server application in the next section of this document. Before we get started with the control, however, we'll cover the basic terminology and concepts behind sockets programming in general. 

  
Top
 
Copyright © 1997 Catalyst Development Corporation. All Rights Reserved.