Client-Server Communication Protocol

 

Game:  Five card stud

 

Basic Overview and goals:  client as dumb as possible, server sending card information, doing data processing, initiating contact

 

Server must have 1 + 2(n) threads:

1)      Listen for connections

2)      Player 1 Connection

3)      Player 2 Connection

Repeat 2-3 as many games as necessary.  Must keep array in memory organize players.

 

To make this work, there must be shared memory between the two players.   We need flags to signal when transfer of information occurred.

 

 

Player 1

Server

Player 2

Connects to server

Listens for connections (1)

Connects to server

 

Sends connections to different sockets (2) (3)

 

Receives data (cards)

Deals, sends data to both

Receives data (cards)

Processes data, send bet

Waits on flag (1)

 Processes data, wait

Wait

Waits on flag (2)

Send call/fold

 

Send new round (repeat)

 

 

 

Transmitted data packets will have the following framework:

 

Type of Packet

Size of Packet

Remaining Packet Data

 

Types of Packets:

 

0 – Ping (also ping reply)

1 – New Round

2 – New Game

3 – Disconnect

4 – Login

5 – Message to other Player

6 – Bet time ran out