Establishes the connection if there are currently less


Write one TCP socket program, confServer.cpp, using select( ) to hold an internet conference for remote users (up to 4 users plus the server).

Note: The data format for sending/receiving is 4 bytes for length of message followed by the message. For example: if you want to send out a message "Hello World" which has 11 characters, you should send out the message in this format: " 11Hello World". The first 4 bytes are " 11". When display the message, do not display the message length.

For the server (confServer.cpp), it hosts the conference: 

when a remote machine (assume its name is Snoopy) requests for connection: 
establishes the connection if there are currently less than 4 clients connected excluding this new one (i.e., a conference can have at most 4 clients at the same time) sends a message: "Welcome, your name please:" 
waits for the first message from this client. (The first message from the client is her/his name. The server can assume that different clients will provides different names) broadcasts "Server: Welcome ClientName." (e.g., "Server: welcome Snoopy.") to all connected clients (including the new connected one). 
if there are 4 client-connections excluding this new one, server sends message to this new client "Sorry, but it is full", and disconnects the connection. 
when a client (say "Snoopy") sends message to server: 
broadcasts this message to every one (including the sender) in the format: Client: Message. (For example, "Snoopy: ruff, ruff.") 
when server has a message (the host can type some words to send to all clients) 
broadcasts this message to every one in the format: Server: Message. 
when a client (say "Snoopy") disconnected: 
broadcasts "Snoopy has logged out" to every one. 

Request for Solution File

Ask an Expert for Answer!!
Computer Networking: Establishes the connection if there are currently less
Reference No:- TGS0132318

Expected delivery within 24 Hours