MultiThreaded Server Socket Program here is a VB.NET Console based application , that can handle multiple clients 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 Multithreaded Socket Programming has two sections.
1. Multithreaded Server Socket Program
2. Multithreaded Client Socket Program
Here we create a Server Socket from TcpListener class and listen to PORT 8888 . When the server gets a request from Client , the Server pass the instance of the client request to a separate class handleClient . In handleClient class there is a Thread , handling the communication between the instance of Server side client and Client from outside .
For each request , in Server there is a new thread instant is create for communication , so we can connect more than one client at the same time to Server and communicate independently .
Create a new VB.NET Console Application project and put the following source code in the project.
VB.NET SourceCode
The Multithreaded Socket Programming has two sections.
1. Multithreaded Server Socket Program
2. Multithreaded Client Socket Program
You have to run Server program first and then Client program , then only you can communicate with Server and Client each other .