www.pudn.com > ChatUseIOCP.rar > ChatServerSocket.h
#pragma once
#include "../DtLibrary/DtServerSocket.h"
#include "ChatServerClient.h"
class CChatServerSocket :
public Datatal::DtServerSocket
{
friend class CChatServerClient;
public:
CChatServerSocket(void);
~CChatServerSocket(void);
// Lets overlaod the WriteLog function and print everything in the dos window.
void OnWriteLog(int nPrio, int nClientId, const char* pszCategory, const char* pszString) const;
protected:
virtual void LoadClient(Datatal::DtServerSocketClient** pClient, int& nId);
const char* GetServerName() { return "ChatServer"; };
/// Will generate a list with all login users.
/// @param pszBuffer Buffer will be filled with data
/// @param nBufSize size of buffer
void GetUserList(char* pszBuffer, size_t nBufSize);
/// Send a message to a user.
void SendMessage(const char* pszFrom, const char* pszTo, const char* pszMessage);
/// Send a message to everyone.
void SendMessage(const char* pszFrom, const char* pszMessage);
/// Send userlist to everyone.
void SendUserList(CChatServerClient* pNotToMe = NULL);
};