00001 00014 #pragma once 00015 00016 #include "../KjSslSocket/KjSslServer.h" 00017 #include "../KjSslSocket/KjSslConnection.h" 00018 #include <pthread.h> // For threads 00019 00020 class KjClientConn 00021 { 00022 KjSslServer *m_pServer; 00023 KjSslConnection *m_pSslConn; 00024 pthread_t m_iThreadId; 00025 pthread_t *m_pThread; 00026 bool m_bIsConnected; 00027 bool m_bIsLockNewThread; 00028 string m_strReadMsg; 00029 string m_strWriteMsg; 00030 bool m_bCanRead; 00031 00032 bool ChatWithClient(); 00033 void ParseClientRequest(string &_strMsg); 00034 void DeleteEndMsg(string &_strMsg); 00035 public: 00036 KjClientConn(KjSslServer *_pServer, pthread_t *_pThread); 00037 ~KjClientConn(); 00038 00039 void NewClient(); 00040 string &ReadMsg(); 00041 void WriteMsg(const string &_strMsg); 00042 00044 KjSslConnection *GetConn() 00045 { 00046 return m_pSslConn; 00047 } 00048 00050 pthread_t &GetThreadId() 00051 { 00052 return m_iThreadId; 00053 } 00054 00055 pthread_t *GetThread() 00056 { 00057 return m_pThread; 00058 } 00059 00060 bool &GetIsConnected() 00061 { 00062 return m_bIsConnected; 00063 } 00064 00065 bool &GetIsLockNewThread() 00066 { 00067 return m_bIsLockNewThread; 00068 } 00069 00070 bool &GetCanRead() 00071 { 00072 return m_bCanRead; 00073 } 00074 };