VB.NET MultiThreaded Socket Programming

Multithreaded Socket Programming means that a Multithreaded Server can communicate with more than one clients at the same time . In the previous section Socket Programming , the Server Socket Program can communicate with only one client at a time . That means it s not possible to connect another Client Socket Program at the same time to communicate with Server . From the following figure you can understand how to a Server can communicate with more than one client at the same time .You can see the basics of Socket Programming in the previous section , take a look at Socket Programming before you start this section.


The basic idea behind Multithreaded Socket Programming is, whenever Server gets a connection request from Client , the Server create a separate ( independent ) Thread for the each Client request. That means for each Client, there is a separate Client Thread in Server . So the Client can communicate independently with their own Client Thread in Server.


In the following sections you can see in detail of How a Multithreaded Socket Programming can communicate with more than one client at the same time.

The Multithreaded Socket Programming has two sections.

1. Multithreaded Server Socket Program

2. Multithreaded Client Socket Program

How to run this program ?

Create Multithreaded Server Socket Program and Multithreaded Client Socket Program and run the Server program first . Then you will get message of "Server started" . Next you start the Client program , then you can see the message from Server . You can start more than one client same time and communicate with Server . For each client Server responds with the Clients Connection ID Number.