HW 6: IPC Socket Talk

Download Solution: Click to Download Solution
Solution File Name: CSampleClientServerChatProgram.docx
Unzip Password: prestobear.com

Problem:
This is the C sample program for client and server chatting
Design and implement TALK Server and Client applications, as described in this Problem Statement.

Overview:
Your application will consist of two separate programs, SERVER.exe and CLIENT.exe. Both programs
will use sockets configured to use the TCP/IP protocols. The user will manually start the server and then
start the client to establish a socket communication linkage.

When the SERVER starts, it will bind itself to listen for connection requests on a system selected
serverport-number. It will print out its server HostName and server-port-number to the user, and then
wait for an incoming client connection request. When a client initiates a connection request, the
SERVER will create and connect a server socket to communicate with the client.

Once the SERVER is running, the CLIENT program can be started using command-line parameters to
specify the server-port-number and (optional) HostName. The CLIENT must create a client socket and
initiate a connection request to the SERVER, thereby establishing a socket-based network
communication path.

Once the connection is established, both the SERVER and the CLIENT applications must engage in a
“talk” session. Any message buffers received through the socket must be displayed to the user, prefixed
on the screen with “<". Any lines of text typed in by the user must be displayed to the user locally, prefixed on the screen with ">“, and then sent to the other process as a message-buffer using the socket.

If the user of either the SERVER or the CLIENT types “exit”, then both applications should quit talking
and terminate. If either the user types “exit”, or if a “exit” message is received via the socket, then
terminate the talk.

Although not required, it is possible in your design to implement one function (e.g., talk(skt) ) that can be
compiled and linked into both the server and the client application.


1.server.c
#pragma comment(lib, "wsock32.lib")
#include < stdlib.h >
#include < stdio.h >
#include < conio.h >
#include < winsock2.h >
#include < windows.h >
#include < winbase.h >

int main(int argc, char *argv[]){

}

2.client.c
#pragma comment(lib, "wsock32.lib")
#include < stdlib.h >
#include < stdio.h >
#include < conio.h >
#include < winsock2.h >
#include < windows.h >
#include < winbase.h >

int main(int argc, char *argv[]){

}

[embeddoc url=”https://prestobear.com/wp-content/uploads/2018/05/ChatHW6Report.pdf” download=”none”]

Add Comment