-
Notifications
You must be signed in to change notification settings - Fork 1
Protocol
Dominik Trusiński edited this page Jun 12, 2018
·
16 revisions
Field | Description | Length in characters | Range of values |
---|---|---|---|
Message type | Type of message | 2 | From 0 to 99 |
Body length | Length of body in bytes | 8 | From 0 to 99999999 |
Number of columns | Number of columns in one frame | 4 | From 0 to 9999 |
Number of rows | Number of rows in one frame | 4 | From 0 to 9999 |
Number of frames | Number of frames | 8 | From 0 to 99999999 |
Frame number | Number of transmitted frame | 8 | From 0 to 99999999 |
Is key frame | Is this frame a key frame | 1 | 0 or 1 |
- When send from server to client this field contains number of sent frame
- When send from client to server this field contains number of desired frame
Each message type is encoded using number. This number is provided below, in parenthesis
Type | Sender | Description | In body |
---|---|---|---|
GET MOVIE LIST(0) | Client | Asks server to present list of available movies | EMPTY |
GIVE MOVIE LIST(1) | Server | Gives movie list to client | Movie list |
GET MOVIE(2) | Client | Asks server to send movie data | Movie name |
GIVE FRAME(3) | Server | Gives frame to client | Frame |
GET FRAME(4) | Client | Asks server for particular frame | EMPTY |
MOVIE FINISHED(5) | Client | Informs server that client has displayed last frame | EMPTY |
DISCONNECT(6) | Client | Informs server that client will disconnect | EMPTY |
SPEED CONTROL INIT(7) | Client | Client informs server that it can start speed control | EMPTY |
SPEED CONTROL FIN(8) | Client | Informs client that his speed has been just updated | Empty |
GIVE SAMPLE (9) | Server | Sends sample of audio | Sample |
Normally when body is empty receiving side does not send confirmation. However in case of SPEED CONTROL INIT, server does send a confirmation with extra garbage so that size of this packet is similar to size of frame data. After receiving this confirmation client sends SPEED CONTROL FIN with timestamp. This message does have a body but confirmation is not send because timestamp has constant width. This width is equal to 20 characters padded with zeros if needed.
Movies are separated by delimeter \n
.
- Client connects
- Clients sends
GET MOVIE LIST
- Server sends
GIVE MOVIE LIST
- Client sends
GET MOVIE
- Server sends
GIVE FRAME
- Client sends
GET FRAME
- When movie finishes, client sends
MOVIE FINISHED
- When client disconnects it sends
DISCONNECT