Starting from:

$34.99

UCS413  Assignment 3 Solution



1. Implement chat server and client-side application program (client/server model) using TCP socket programming in connection- oriented Scenario.

Steps to be followed:

Server Side:
• Include appropriate header files.
• Create a TCP Socket.
• Bind the address and port using bind() system call.
• Server executes listen() system call to indicate its willingness to receive connections.
• Accept the next completed connection from the client process by using an accept() system call. At this point, connection is established between client and server, and they are ready to transfer data.
• Receive a message from the Client using recv()/read() system call.
• Send the result of the request made by the client using send() system call.
• Close the socket using close() system call.

Client Side:
• Include appropriate header files.
• Create a TCP Socket.
• Establish connection to the Server using connect() system call.
• Send and recieve messages using send() and recv() system call respectively.
• Close the socket using close() system call.

Execution Steps:
• . Save client and server program into two separate files with .c extension.
• . Open two terminal and execute .c files by following commands
• . gcc filename.c –o filename (compilation)
• ./filename (run)


More products