UNX511 Winter2012 TeamB Network Protocol

From CDOT Wiki
Revision as of 15:04, 2 April 2012 by Idshibanov (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Network Core - General

All network protocol related source files are located in /net folder.

To prevent confusion, everything with "Client" in its name (e.g. ClientStatus or ClientSocketHandler) works on the client side, and similarly everything with "Server" - on the server side.

Basic algorithm:

  • 1. Client connects to a server, creates an instance of ClientSocketHandler class
  • 2. To send data, client uses functions inside ClientSocketHandler class (e.g. SendChatMsg)
  • 3. Client runs select() function, and if there is something, uses RecvPacket() function

Authorization Process

enum ClientStatus{
    STATUS_CLIENT_OFFLINE,        // initial state
    STATUS_CLIENT_REGISTRATION,   // trying to register
    STATUS_CLIENT_CONNECTED,      // just connected
    STATUS_CLIENT_AUTHORIZED,     // succesfully logged in
    STATUS_CLIENT_JOINED,         // joined game lobby (intermission)
    STATUS_CLIENT_GAME_STARTED,   // game is starting
    STATUS_CLIENT_GAME_INIT,      // downloading game map data
    STATUS_CLIENT_GAME_READY,     // ready to go
    STATUS_CLIENT_GAME_ACTIVE,    // playing
    STATUS_CLIENT_END             // always at the end
};


Network Packet


Client Socket Handler

ClientSocketHandler is a derived class from a abstract SocketHanlder and contains member functions that work specifically on a client side.

Server Socket Handler

Will be documented later.

Links