使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 4905e2e7537d507f218e8e9595485e09d9f3a2b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// QLCommander.h: interface for the CQLCommander class.
//
//////////////////////////////////////////////////////////////////////
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
class CQLRequest;
class CQLResponse;
class CQLClientSocket;
class CQLClient;
class CQLConnect;
class CQLSession;
class CQLSysMsg;
 
#include "Event.h"
 
#define        CMDER_TYPE_CMDER        ( 0 )
#define        CMDER_TYPE_PROGRESS        ( 1 )
 
#define        BUFFSIZE        (1024 )    // ( 65536 )
 
class AFX_EXT_CLASS CQLCommander  
{
public:
    friend class CQLClient;
 
    CQLCommander();
    virtual ~CQLCommander();
 
// Attributers
public:
    CQLManualResetEvent        m_Event;
    CQLManualResetEvent        m_EventClose;
 
    CString        m_strMethod;
    long        m_nTrID;
 
    CString        m_strServerName;
    long        m_nServerPort;
    int            m_nType;
 
    CQLClient    *m_pClient;
    CQLConnect    *m_pConnect;
    CQLSession    *m_pSession;
    CQLSysMsg    *m_pSysMsg;
 
    CPtrList    m_listSocket;    // CQLClientSocket Á´±í
 
    BOOL        m_bIsCancel;        // Is Canceled
 
protected:
#ifdef _UNICODE
    BYTE        m_bTrunc;        // Lineת»»ºóÁôϵÄ(ÔÚLinedÖ®ºó£©
    BOOL        m_bHaveTrunc;
#endif
 
// Operations
public:
    void        SetOIClient( CQLClient *pClient );
    void        SetOIConnect( CQLConnect *pConnect );
    void        SetOISession( CQLSession *pSession );
    void        SetOISysMsg( CQLSysMsg *pSysMsg );
    void        SetMethod( CString strMethod );
 
    virtual void    OnConnected( CQLClientSocket *pSocket );                        // Á¬½Ó
    virtual BOOL    OnResponse( CQLResponse *pResponse, CQLClientSocket *pSocket );    // ½ÓÊÕ
    virtual BOOL    RecvBuf( CQLRequest *pRequest  );                                // ·¢ËÍÊý¾Ý£¬È總¼þ
 
    virtual void    OnConnectionErr( CQLClientSocket *pSocket, int nErrorCode );    // Á¬½Ó³ö´í
    virtual void    OnValidateErr( CQLClientSocket *pSocket, int nErrCode );        // ¼ìÑé³ö´í
    virtual void    OnConnectedClosed( CQLClientSocket *pSocket );                // Á¬½Ó¹Ø±Õ
    virtual void    OnSndCmdComplete(CQLRequest *pRequest);                        // ·¢ËÍÃüÁî³É¹¦
 
    void        SetCancel( BOOL bCancel = true )    { m_bIsCancel = bCancel; }
    BOOL        IsCancel()    { return m_bIsCancel; }
    bool        CreateRequestBySysMsg( CQLClientSocket *pSocket );
    BOOL        OnValidateResponse( CQLResponse *pResponse, CQLClientSocket *pSocket );
 
    void        FreeAllSocket();
 
protected:
    CString        ResponseBody( CQLResponse *pResponse );
 
private:
//    void        FreeAllSocket();
    void        RemoveSocket( CQLClientSocket *pSocket );
    void        AddSocket( CQLClientSocket *pSocket );
};