In this program, you will make a connection to a remote host and accept an incoming connection from other hosts (at most one at a time). When you are making a connection, you are the client. When you are receiving a connection you are the server. Servers and clients should obey the following protocol and optional or variable types are listed within square brackets []: In your client UI, you should have an option to list all known commands and their responses. This is denoted with the command SHOW. When you type SHOW into the client, the client should show all learned and known commands/responses. (This should not communicate with the connected server in any way). Do not list commands listed in the protocol, only new ones. Clients will always initiate any sequence of executed comamnds: -REQ Server will respond with an ip/port pair of another server it knows or [UNK] -LIST server should respond with an integer n followed by n messages These n messages list n commands that are possible on this server List Learn, Bye and Fetch are not listed as part of LIST. The client should send OK to each response from the server except the last. -BYE Server and client should then shutdown and close the connection -FETCH [DIST] This is a request that connected servers learn new commands up to a distance of [DIST]. If [DIST] is 1, the server responds with the message COMPLETE 1. If [DIST] is more than 1, the server will send a fetch request as a client to its server with a value 1 less than [DIST]. So, if [DIST] is 5, the server will send a FETCH 4 to its client. If the server has sent a FETCH request with a value of 4 or more in the last minute, it may skip this step and simply respond with the proper COMPLETE. If the server actualy has no other connections, it may skip this step and respond with the proper COMPLETE. If [DIST] is larger than 999 or less than 1, it can be ignored. Response to FETCH [DIST] should be COMPLETE [DIST]. Client then sends LIST followed by LEARN [CMD] for any new commands it does not already know and the server simply responds to those requests as normal. Servers are required to keep newly learned commands up to 10 (but may keep many many more) and may (but are not required to) release commands after 60 seconds. If a FETCH request is received while waiting for a COMPLETE, the server should respond with INCOMPLETE [DIST] to denote that the server is currently busy. In this case, no recursive FETCH [DIST]-1 should be sent. -LEARN [CMD] Server responds with the proper response for [CMD] If [CMD] is unknown by the server at this time, the server will respond with "[UNK]" without the quotation marks. -[OTHER] Servers will learn other commands throughout this process and should respond with a message of at most 63 bytes. -TEACH [CMD] Server responds with "OK" or "NO" OK means the server is ready to learn the command. Client should then send the text of that command. Server responds with same text. NO means the server is not ready to learn the command and this branch of execution is over. Sample execution between a client connected to a server. Automatic responses are preceeded by a - for clarity. Client connections to server. Client sends LIST -Server sends 0 Client sends FETCH 1 -Server sends COMPLETE 1 -Client sends LIST -Server sends 1 -Client sends OK -Server sends SECRET -Client sends LEARN SECRET -Server sends My favorite color is orange. Client sends FETCH 5 Server sends FETCH 4 to its server when it is acting as a client. Server processes and may pause. During this time the client may actually receive a fetch from a circular set of connects but the client would be acting as a server in that case and would respond to its client as a server. When done processing, presumably, the server has learned another secret. -Server sends COMPLETE 5 -Client sends LIST -Server sends 2 -Client sends OK -Server sends SECRET -Client sends OK -Server sends SECRET2 -Client sends LEARN SECRET2 -Server sends Burgundy is another favorite color. It is also possible that the client would have to learn more than one thing from a fetch. It is also possible that clients can forget some things if they must for memory's sake (as denoted by the time limit and message memory limit above). - Client sends TEACH ORANGE - Server sends OK - Client sends Orange you glad I taught you this. - Server sends Orange you glad I taught you this. - Client sends TEACH ORANGE - Server sends NO