A Socket is an End-Point of To and From (Bidirectional) communication link between two programs (Server Program and Client Program ) running on the network . We need two programs for running a socket program. A Server Socket Program ( Server ) and a Client Socket Program ( Client ) .
Server Program: A Server Socket Program running on a computer has a socket that bound to a Port Number on that computer and listening to the client's requests.
Client Program: Client Socket Program have to know the IP Address ( Hostname ) of the computer that the Server Socket Program resides and the Port Number assign for listening for client's request .
Once the communication is established , the Server and Client can read or write their own sockets.
There are two types of communication protocol use for Socket Programming TCP/IP ( Transmission Control Protocol/Internet protocol ) Communication and UDP/IP ( User Datagram Protocol/Internet protocol ) Communication .
In the following section we are going to communicate a Server Socket Program and Client Socket Program through VB.NET using TCP/IP Communication.
In the above picture shows the communication interfaces .
Server Socket Program:
Here Server Socket Program is done through a Console based VB.NET application . Here the Server listening for the client's request , and when the server get a request from the Client , Server sends the response to Client . Click the following link to see in detail of a Server Socket Program .
Client Socket Program:
The Client Socket Program is a windows based application . When the client start its get connect the server and send requests , and also receive the response from Server . Click the following link to see in detail of Client Socket Program.
How to run this program ?
The Socket Programming has two sections.
1. Server Socket Program
2. Client Socket Program
When you finish coding the program , First you have to start Server Socket Program , then you will get the DOS screen with a message Server Started .
Next step is to start Client Socket Program . Then you will get message in client screen Client Started , at the same time you check with server screen a message Accept connection from client .
Now your Server Socket Program and Client Socket Program get connected . If you want to test the communication , you click the button ( Click here to send data to Server ) in client window , then you can see changes in Server and Client screen messages .