Library tutorials & articles

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.

Comments

  1. 08 Jan 2005 at 15:46

    I need some help. I want to make the server client program work over the internet, not just a LAN. So my friend can use the client, and I can be the server and we can sedn messages back and forth. Can someone help me with this?

  2. 10 Jul 2003 at 01:43

                    we have established connection between server & client. It works ok when we pass queries from just one form. when we want to load many forms at a time with only a single connection some error has occured. only the first form loads from the database without error when the next form loads there is some error in the connection.
                        could you help us?
                                 

  3. 01 Jan 1999 at 00:00

    This thread is for discussions of SocketWrench Control.

Leave a comment

Sign in or Join us (it's free).

Catalyst Development

Related discussion

Related podcasts

  • Listener Feedback 67

    This mailbag episode includes FASM, scripts, sockets, SSL/TLS, HTTPS, Windows 7's XP mode, and more. Security Now wiki shownotes For 16kpbs versions, transcripts, and notes (including fixes), visit Steve's site: grc.com, also the home of the best disk maintenance and recovery utility ever written...

We'd love to hear what you think! Submit ideas or give us feedback