开源的socket服务端客户端,支持C# C++

ClientDlg.h 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // ClientDlg.h : header file
  2. //
  3. #pragma once
  4. #include "afxwin.h"
  5. #include "../../../Src/SSLClient.h"
  6. #include "../../Global/helper.h"
  7. // CClientDlg dialog
  8. class CClientDlg : public CDialogEx, public CTcpClientListener
  9. {
  10. // Construction
  11. public:
  12. CClientDlg(CWnd* pParent = NULL); // standard constructor
  13. // Dialog Data
  14. enum { IDD = IDD_CLIENT_DIALOG };
  15. protected:
  16. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  17. virtual BOOL PreTranslateMessage(MSG* pMsg);
  18. // Implementation
  19. protected:
  20. HICON m_hIcon;
  21. // Generated message map functions
  22. virtual BOOL OnInitDialog();
  23. afx_msg void OnPaint();
  24. afx_msg HCURSOR OnQueryDragIcon();
  25. afx_msg void OnEnChangeContent();
  26. afx_msg void OnBnClickedSend();
  27. afx_msg void OnBnClickedStart();
  28. afx_msg void OnBnClickedStop();
  29. afx_msg LRESULT OnUserInfoMsg(WPARAM wp, LPARAM lp);
  30. afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
  31. DECLARE_MESSAGE_MAP()
  32. public:
  33. void SetAppState(EnAppState state);
  34. private:
  35. virtual EnHandleResult OnSend(ITcpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
  36. virtual EnHandleResult OnReceive(ITcpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
  37. virtual EnHandleResult OnClose(ITcpClient* pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
  38. virtual EnHandleResult OnConnect(ITcpClient* pSender, CONNID dwConnID);
  39. virtual EnHandleResult OnHandShake(ITcpClient* pSender, CONNID dwConnID);
  40. private:
  41. CEdit m_Content;
  42. CButton m_Send;
  43. CListBox m_Info;
  44. CEdit m_Address;
  45. CEdit m_Port;
  46. CButton m_Async;
  47. CButton m_Start;
  48. CButton m_Stop;
  49. BOOL m_bAsyncConn;
  50. EnAppState m_enState;
  51. CSSLClient m_Client;
  52. };