SocketWrench Control

Sample Client Application

The sample program that will be used throughout this document is a simple tool that can be used to connect with an echo server, a program which echoes back any data that’s sent to it. Later on, we’ll also cover how to implement your own echo server.

The first step, after starting Visual Basic, is to include the SocketWrench control in your new project. In Visual Basic 3.0, select the File|Add File option from the menu and a file selection dialog will be displayed. Enter the complete pathname of the control, such as c:windowssystemcswskctl.vbx. To add the control to the list of available controls, click on the Browse button and enter the complete pathname of the control. In Visual Basic 4.0, you should select Tools|Custom Controls, while in Visual Basic 5.0, you should select Project|Components. A dialog will display all of the available ActiveX controls, then select the Catalyst SocketWrench Control.

After the control has been added to the tool palette, you will also need to include the Visual Basic module wrench.bas, which contains the constants used by SocketWrench. This file is located in the sample subdirectory created for each version of Visual Basic during installation. For Visual Basic 3.0 and 4.0, select the File|Add File menu option and enter the full pathname of the file (this procedure is the same for all versions of Visual Basic). For Visual Basic 5.0, select the Project|Add File menu option.

To begin, you’ll need to create a form that has three labels, three text controls, a button and the SocketWrench control. The form might look something like this:

Visual Basic Form

When executed, the user will enter the name or IP address of the system in the Text1 control, the text that is to be echoed in the Text2 control, and the server’s reply will be displayed in the Text3 control. The Command1 button will be used to establish a connection with the remote server. The Text2 and Text3 controls should be created with their Enabled properties initially set to False.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou