In: Computer Science
(Before you try writing code to solve this problem, I'd suggest experimenting with the server a bit, using PuTTY on Windows, or using telnet or nc on macOS.)
What your program should do is hide all of these details, which means it would do the following:
I will not be giving the detailed code, just a break-down on how to approach this problem.
Hint1: Qn states a client and server. So at min. there needs to
be 2 file.
File1: Only Server Code, which will keep on listening.
Recommendation: Use some tool/package to kee the file running, like
Platform.sh, Google Cloud, simpleHTTPServer
File2: Only client Code. This file will contain only
packet sending information
Hint 2: There are dictionaries kept only at the server end.
Construct this in any way you feel comfortbale to traverse. A table
containing, 10 Names, 15 verbs, 20 insults for e.g {Name:
[a,v,b,ag,g,..], Verbs: [is, are,....], Insults: [**s, ***t, ***k,
]
NOTE: If server creation and hosting is not part of syllabus, modify the problem to a simple UI/CLI based interaction. In UI/CLI enter these values as client. In server/program validate these values, and send appropriate response to UI/CLI
Data Flow between C&S
Client Server Remarks
Shakespeare_COUNTS
// Client-> Server
15 20 30
// Server -> Client (SizeOf name[], verbs[],
and insults[])
Shakespeare_Insults 6 5 3 // Random Nos
generated in client, or given by some user input
A am
***t
// Final result
Shakespeare_GoodBye