Client checks for ServerInvalidRequestReply,
If server responded with ServerInvalidRequestReply, client should not send anything back to server
Client verifies ServerGameReply
Client
ClientGetGame:
struct GetGameMessage {
client_id = RANDOM_ID,
hdr.type = ClientGetGame,
hdr.len = sizeof(struct GetGameMessage)
}
ServerGameReply:
struct GameSummaryMessage {
hdr.type = ClientGetGame,
hdr.len = sizeof(struct GetGameMessage) client_id = RANDOM_ID,
game_id = SERVER_GAME_ID,
x_positions = X_POSITIONS,
y_positions = Y_POSITIONS
}
ClientResult:
struct GameResultMessage {
hdr.type = ClientResult, hdr.len(sizeof(struct GameResultMessage)), game_id = SERVER_GAME_ID,
result = [X_WIN or O_WIN or
}
CATS_GAME or INVALID_BOARD]
ServerClientResultCorrect: struct TTTMessage {
len = sizeof(struct TTTMessage), type = [ServerInvalidRequestReply or ServerClientResultIncorrect or
}
ServerClientResultCorrect]
Server
Server verifies Client GetGameMessage
If valid, Server generates ServerGameReply Message
If invalid, Server generates ServerInvalidRequestReply Message
Server checks whether ClientResult is formatted properly Server checks whether client gave the correct result
Server responds with a TTMessage with
type ServerInvalidRequestReply, ServerClientResultCorrect, or ServerClientResultIncorrect