HY335a-Project
A_multithread_chat_Server_and_chat_client
|
The header file of the chatclient. More...
#include <stddef.h>
#include <string>
Go to the source code of this file.
Classes | |
class | chatclient |
Enumerations | |
enum | msg_type_t { LOGIN_MSG = 0x1, LOGOUT_MSG = 0x2, TEXT_MSG = 0x3, USERNAME_NOT_EXIST = 0x4, USER_ALREADY_LOGGED = 0x5, USERS_LOGGED_REQUEST = 0x6, USERS_LOGGED_RESPONSE = 0x7, BROADCAST_MSG = 0x8, UKNOWN_MSG_TYPE = 0xFE, GENERAL_ERROR = 0xFF, LOGIN_MSG = 0x1, LOGOUT_MSG = 0x2, TEXT_MSG = 0x3, USERNAME_NOT_EXIST = 0x4, USER_ALREADY_LOGGED = 0x5, USERS_LOGGED_REQUEST = 0x6, USERS_LOGGED_RESPONSE = 0x7, BROADCAST_MSG = 0x8, UKNOWN_MSG_TYPE = 0xFE, GENERAL_ERROR = 0xFF } |
The header file of the chatclient.
This header file contains several structures that are vital, in order to implement your server.
Also contains the declarations of several functions. All the functions below MUST be implemented, WITHOUT changing its parameters or their return types.
Although you are welcome to add your own.
Note that in your program you should use, all of them, having in mind that some of them are called inside some other.
For questions, problems, or bugs of this header file just email me.
May the code be with you... :)
enum msg_type_t |
The different types of messges. The message type is the first byte of every message from the client to the server and vice versa.
As the message type is only one byte we do not care about endianess problems. r NOTE 1: Each message number is in hexademical form. NOTE 2: Enum in C are at least two bytes, so make sure that you take the right byte when you send it. A simple cast to unsigned char would be enough. (Or not? :P ) NOTE 3: Fill free to add your own message types However, they must be unique, one byte long, and be carefull to be the same at the server and at the client.