WinSock Control

Running the Program

Firstly, we need to check that the program works on one PC. To do this, follow these steps:

1. Run the project.
2. Click both the Client and Server command buttons. Move the windows around so that you can see them all.
3. Enter the name of the PC into the PCName Text Box. (This appears after the @ sign on the Server form's caption)
4. Click Connect on the Client form.
5. Enter some text into the Send text box on the Client form, and click Send
6. The text should appear in the Receive text box on the Server form. If you get an error, check that the PC name in the PCName text box, is the same as the LocalHostName on frmServer. Click here for how to do this.
7. Now, enter some text into the Send text box on the Server form, and click Send. The text should appear in the Receive text box on the Client form.

If you have had no errors, then everything works fine. Now, to see the program working over a proper network, follow these steps:

1. Compile the project
2. Run the EXE program on one PC, and click the Server command button
3. Run the EXE program on another PC, and click the Client command button
4. Enter the name of the PC that is running the Server form. (This appears after the @ sign on the Server form's caption)
5. Click Connect on the Client form.
6. Enter some text into the Send text box on the Client form, and click Send
7. Run back to the PC running the Server form (!), and you should see the text you entered in the Receive textbox.
8. Try sending some text from the Server form
9. Pat yourself on the back for learning the basics of the WinSock control!

If you have had any problems creating this example program, you can download it by clicking here.

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

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.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond