20 lines
751 B
Text
20 lines
751 B
Text
for client:
|
|
server parses packets from left to right like this:
|
|
[u16 length][u8 type][char *data]
|
|
|
|
length: the length of the entire packet
|
|
type:
|
|
PACKET_ERROR = 0
|
|
PACKET_REGISTER = 1
|
|
PACKET_AUTHENTICATE = 2
|
|
PACKET_JOIN = 3
|
|
PACKET_TEXT = 4
|
|
PACKET_LEAVE = 5
|
|
|
|
data: bytes of data, what it could represent depends on the packet type
|
|
(following layouts are layouts for data byte array)
|
|
PACKET_REGISTER : [char username[20]][char password[20]]
|
|
PACKET_AUTHENTICATE : [char username[20]][char password[20]]
|
|
PACKET_JOIN : []
|
|
PACKET_TEXT :
|
|
PACKET_LEAVE :
|