Question: No chat gpt #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main ( ) { int MySocket,
No chat gpt #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main
int MySocket, portNum, nBytes;
char inputbuffer;
char receivedmsg;
char portstring;
char ipstring;
struct sockaddrin serverAddr;
socklent addrsize;
int i ;
std::string Query
"car",
"elephant",
"flower",
"monkey",
"garbage";
Create UDP socket
MySocket socketAFINET, SOCKDGRAM, ;
Configure settings in address struct
serverAddr.sinfamily AFINET;
portNum atoi;
serverAddr.sinport htonsportNum;
serverAddr.sinaddr.saddr inetaddr;
memsetserverAddrsinzero, sizeof serverAddr.sinzero;
Initialize size variable to be used later on
addrsize sizeof serverAddr;
srandtimeNULL;
for int count ; count ; count
i rand;
strcpyinputbuffer, Queryicstr;
nBytes strleninputbuffer;
sendtoMySocket inputbuffer, nBytes, struct sockaddr &serverAddr, addrsize;
cout "Sent em inputbuffer em to server...
;
nBytes recvfromMySocket receivedmsg NULL, NULL;
cout "Received from server: em receivedmsg em endl;
sleep;
memsetinputbuffer, sizeof inputbuffer;
strcpyinputbuffer, "Quit!";
nBytes strleninputbuffer;
sendtoMySocket inputbuffer, nBytes, struct sockaddr &serverAddr, addrsize;
return ;
In this problem you will create a TestServer program that will do the following:
The TestClient will contact server on port
When received "car", the server will send "fast" to the client.
When received "flower", the server will send "beautiful" to the client.
When received "elephant", the server will send "mouse" to the client.
When received "monkey", the server will send "banana" to the client.
When received "Quit!", the server will terminate.
When received something the server cannot recognize, the server will send "what?" to the client.
Please downlad right click and save the attached TestClient code and compile it on your Ubuntu. Do not change the code.
You will create a server code with C in VSCode. Compress your project folder and upload to here. Sample run of client and server:In this problem you will create a TestServer program that will do the following:
The TestClient will contact server on port
When received "car", the server will send "fast" to the client.
When received "flower", the server will send "beautiful" to the client.
When received "elephant", the server will send "mouse" to the client.
When received "monkey", the server will send "banana" to the client.
When received "Quit!", the server will terminate.
When received something the server cannot recognize, the server will send "what?" to the client.
Please downlad right click and save the attached TestClient code and compile it on your Ubuntu. Do not change the code.
You will create a server code with C in VSCode. Compress your project folder and upload to here. Sample run of client and server:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
