#if !defined(AFX_CQLLIENTSOCKET_H__9C4B6388_CFBC_42DA_A325_5053AD6F1C49__INCLUDED_) #define AFX_CQLLIENTSOCKET_H__9C4B6388_CFBC_42DA_A325_5053AD6F1C49__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // QLClientSocket.h : header file // #include #include "AsyncProxySocket.h" #include "HighTime.h" class CQLClient; class CQLRequest; class CQLResponse; class CQLCommander; ///////////////////////////////////////////////////////////////////////////// // CQLClientSocket command target class AFX_EXT_CLASS CQLClientSocket : public CAsyncProxySocket { // public: CQLClientSocket( CQLClient *pClient, CQLCommander *pCommander = NULL); virtual ~CQLClientSocket(); public: CString m_strMsg; bool m_bInFree; CString m_strPrvMethod; CQLCommander *m_pCommander; // modify wangcheng 2008/09/26 ÈôÏûÏ¢SocketÔÚ2·ÖÖÓÄÚδʹÓÃÔò×Ô¶¯Êͷŵô CHighTime m_tmUsed; // ³£ÓÃÁ¬½ÓÆôÓõÄʱ¼ä CHighTime m_tmFree; // ³£ÓÃÁ¬½ÓÊͷŵÄʱ¼ä UINT m_nTimeoutTimer; // ³¬Ê±¶¨Ê±Æ÷ID private: long m_nRef; #ifdef _UNICODE BYTE m_bLined; // GetLine ÁôÏ嵀 BOOL m_bHaveLined; BYTE m_bTrunc; // Lineת»»ºóÁôϵÄ(ÔÚLinedÖ®ºó£© BOOL m_bHaveTrunc; #endif CByteArray m_buf; // ÓÃÓÚ·¢ËÍÊý¾ÝµÄbuffer CString m_strLine; CQLClient *m_pClient; CPtrList m_listRequest; CQLResponse *m_pResponse; BOOL m_bValidate; // ÊÇ·ñÒÑͨ¹ýÑéÖ¤ BOOL m_bMustValidate; // ÐèÒªÑéÖ¤ bool m_bReTry; // ÊÇ·ñÒÑÖØÊÔÁË UINT m_nSndEventCount; // end modify // Operations public: void ClearData(); BOOL GetMustValidate(); void SetMustValidate( BOOL bMustValidate ); void SetValidate( BOOL bValidate ); BOOL IsValidate(); long Release(); long AddRef(); void Free(); void SetCommander( CQLCommander *pCommander ); void SetOIClient( CQLClient *pClient); BOOL Connect( LPCTSTR lpszHostAddress, UINT nHostPort ); BOOL Connect( const SOCKADDR *lpSockAddr, int nSockAddrLen ); void AbortCommand(); BOOL SendCommand( CQLRequest *pRequest ); static void PASCAL AuxQueueAdd( UINT message, WPARAM wParam, LPARAM lParam ); virtual void OnListenFinished( unsigned long &retProxyIp, int &retProxyPort ); virtual void OnProxyOperationFailed( int nOpID ); virtual void OnProxyConnectionEstablished(); virtual BOOL PumpMessages( UINT uStopFlag ); virtual int SendChunk( const void *lpBuf, int nBufLen, int nFlags = 0 ); virtual int Send( const void *lpBuf, int nBufLen, int nFlags = 0 ); bool StartTimeoutTimer( CString strFuncName ); void EndTimeoutTimer( CString strFuncName ); void OnTimeout(); private: BOOL GetLine( LPBYTE pBuffer, const long nSize, long &ndx ); static VOID CALLBACK _TimerProc( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ); // Overrides public: // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CQLClientSocket) public: virtual void OnReceive(int nErrorCode); virtual void OnSend(int nErrorCode); virtual void OnClose(int nErrorCode); virtual void OnConnect(int nErrorCode); //}}AFX_VIRTUAL // Generated message map functions //{{AFX_MSG(CQLClientSocket) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG // Implementation protected: virtual BOOL OnMessagePending(); }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_CQLLIENTSOCKET_H__9C4B6388_CFBC_42DA_A325_5053AD6F1C49__INCLUDED_)