© 2012 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies
« NS2  Projects »

Home Lab Exercise Network Lab Exercise Programs Implementation Of Client-Server Communication Using TCP▼


Implementation Of Client-Server Communication Using TCP:

Algorithm Steps:

Server:

Step 1: start

Step 2: create a socket with address family AF_INET, type SOCK_STREAM and default protocol.

Step 3: Initialize the socket and set its attributes assign any port number as desired.

Step 4: Bind the server to the socket using bind() function.

Step 5: Establish the listen queue using the listen function.

Step 6: wait for client program on request, establish a connection using accept function.

Step 7: Repeat steps 8-10 until the server sends bye.

Step 8: Read the message from the client using read() function. display the message.

Step 9: If the client message is bye go to step 11.

Step 10: Accept the server message and write it to client using write() function.

Step 11: close the connection.

Step 12: Go to step 6.

Client:
 
Step 1: Start.

Step 2: Create a socket with address family AF_INET type SOCK_STERAM and default protocol.

Step 3: Initialize the socket and set it attributes set the required port number.

Step 4: Connect to the server using connect() function to initialize the request.

Step 5: Repeat steps 6-8 until server sends bye

Step 6: Accept the client message and write it to the server using write function.

Step 7: If the client message is bye go to step 9.

Step 8: Read the message from the server using read() function. Display the message.

Step 9: stop.

CPP Program For Client-Server Communication Using TCP

 
SLogix Student Projects

⇓ Student Projects ⇓
⇑ Student Projects ⇑
bottom