Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Task : Implement the client and the simulation server for the following protocol

ID: 3887486 • Letter: T

Question

Task: Implement the client and the simulation server for the following protocol in Python 3. For full credit, your code must run correctly. Partial credit may be awarded for correctly running code that implements only some of the required functions or for code that does not run but is clearly on the right track. For aspects of the system’s behavior that are not specified, you may make any reasonable design decisions. Turn in your code as python source files (with a .py extension).

Protocol title: Thermostat Application Protocol (TAP)

Goal: TAP is an application-layer Internet protocol that is designed to allow a remote user to check the temperature of the house as measured by the thermostat, and to set the desired temperature of the thermostat. TAP uses a client-server architecture in which the thermostat functions as the server. In the simulation, the server always sends the same value when asked for the temperature (72), and the server prints the new desired temperature when asked to set the desired temperature.

Narrative description: To check the temperature, a TAP client first establishes a TCP connection with the TAP server. Upon receiving the READY message from the server, the client then sends a CHECK message. The server responds with a TEMP message containing the current measured temperature (in the simulation, the server always responds with the value 72). Upon receiving the TEMP message, the client then displays the temperature to the user and closes the TCP connection. To set the temperature, the TAP client first establishes a TCP connection with the TAP server. Upon receiving the READY message from the server the client then sends a SET message containing the new desired temperature. The server responds with a SETPOINT message that contains the new desired temperature after it has been set. Upon receiving the SETPOINT message, the client then informs the user that the temperature has been set and closes the TCP connection.

Messages that can be sent by the Client:

TAP 1.0 CHECK

TAP 1.0 SET {temp}

Messages that can be sent by the Server:

TAP 1.0 READY

TAP 1.0 TEMP {temp} TAP 1.0 SETPOINT {temp}

In the SET, TEMP and SETPOINT messages, {temp} must be an two-digit ASCII sequence representing an integer between 35 and 99 that is to be interpreted as a temperature on the Fahrenheit scale.

CHECK-TEMP Sequence Diagram: Client Server Initiate TCP connection to server Accept TCP connection and send READY message Send CHECK message Respond with TEMP message Display temperature to user and close TCP connection

Explanation / Answer

namespace java graph namespace py graaph typedef i32 int // We can use typedef to get pretty names for the types we are using service MultiplicationService { int multiply(1:int n1, 2:int n2), } import org.apache.thrift.TException; public class MultiplicationHandler implements MultiplicationService.Iface { @Override public int multiply(int n1, int n2) throws TException { System.out.println("Multiply(" + n1 + "," + n2 + ")"); return n1 * n2; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote