Question: Write two programs that play a trivia game using a socket. Include examples of your program output in a report. Ifyou wish, you may use

 Write two programs that play a trivia game using a socket.

Include examples of your program output in a report. Ifyou wish, you

Write two programs that play a trivia game using a socket. Include examples of your program output in a report. Ifyou wish, you may use a fixed port number and IP address of 127.0.0.1. Create separate server and client programs (two c files) according to the following design requirements: The server is assumed to be executed before the client. The server creates a socket. When the client connects, the server writes the trivia question and artenpts to receive the answer. Note that accept and "Tead are blocking fumctions, au in class. . The client, which is started after the server, reads and displays the question. . The client allows the user to type an answer and writes it to the socket. .The server reads the client's answer, displays it, and compares it to the correct answer (which is known by the server). The server writes the result message (correct or incorrect) to the socket. . The client reads the result and displays it to the user. Below are examples of how your output might look (user input is in bold). The trivia question in both examples is "What is the capital of Greece?". n example #1, the client's user types the correct answer "Athens". In example #2. the client's user types the incorrect answer "London Server example #1 Sent question. Answer received: Athens Client example #1 What is the capitol of Greece? Athens Waiting for result... Correct! Server example #2 Sent cruestion. Answer received: London Client example #2 What is the capitol of Greece? London Waiting for result... Wron

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!