CS435 Homework 4: Server and Client
Due Wednesday, February 23
Create a client/server system that will convert prices from US dollars to sheep. Any client can update the server with the current price of a sheep, and the server will not perform any validation on sheep pricing. The protocol allows 3 messages. The client can send three of them:
The server will reply to all client messages. It has two possible messages that can be used to reply:
- Set value. This consists of a single byte which should have the value one, followed by a 64-bit floating-point number.
- Convert value, sheep to USD. This will convert a number of sheep to US dollars. It will consist of a single byte having the value two, followed by a 64-bit floating point number of sheep.
- Convert value, USD to sheep. This will convert a number of US dollars to a number of sheep. It will consist of a single byte having the value three, followed by a 64-bit floating point number of USD.
Turn in the source code for both the client and the server.
- Set ok. This will be a single byte, having the value 4. It will be sent in response to a set value.
- Conversion result. This will be a single byte having the value 5, followed by a 64-bit result. The server should reply in order to client requests, so the client can determine whether the value represents dollars or sheep based on what the client sent to the server.