ServerDlg.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // ServerDlg.h : header file
  2. //
  3. #pragma once
  4. #include "afxwin.h"
  5. #include "../../../Src/HPSocket4C.h"
  6. #include "../../Global/helper.h"
  7. // CServerDlg dialog
  8. class CServerDlg : public CDialogEx
  9. {
  10. // Construction
  11. public:
  12. CServerDlg(CWnd* pParent = NULL); // standard constructor
  13. ~CServerDlg(); // standard destructor
  14. // Dialog Data
  15. enum { IDD = IDD_SERVER_DIALOG };
  16. protected:
  17. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  18. virtual BOOL PreTranslateMessage(MSG* pMsg);
  19. // Implementation
  20. protected:
  21. HICON m_hIcon;
  22. // Generated message map functions
  23. virtual BOOL OnInitDialog();
  24. afx_msg void OnPaint();
  25. afx_msg HCURSOR OnQueryDragIcon();
  26. afx_msg void OnBnClickedStart();
  27. afx_msg void OnBnClickedStop();
  28. afx_msg LRESULT CServerDlg::OnUserInfoMsg(WPARAM wp, LPARAM lp);
  29. afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
  30. afx_msg void OnBnClickedDisconnect();
  31. afx_msg void OnEnChangeConnId();
  32. DECLARE_MESSAGE_MAP()
  33. public:
  34. void SetAppState(EnAppState state);
  35. private:
  36. static En_HP_HandleResult __stdcall OnPrepareListen(SOCKET soListen);
  37. static En_HP_HandleResult __stdcall OnAccept(HP_CONNID dwConnID, SOCKET soClient);
  38. static En_HP_HandleResult __stdcall OnSend(HP_CONNID dwConnID, const BYTE* pData, int iLength);
  39. static En_HP_HandleResult __stdcall OnReceive(HP_CONNID dwConnID, const BYTE* pData, int iLength);
  40. static En_HP_HandleResult __stdcall OnClose(HP_CONNID dwConnID, En_HP_SocketOperation enOperation, int iErrorCode);
  41. static En_HP_HandleResult __stdcall OnShutdown();
  42. private:
  43. TPkgInfo* FindPkgInfo(HP_CONNID dwConnID);
  44. void RemovePkgInfo(HP_CONNID dwConnID);
  45. private:
  46. CListBox m_Info;
  47. CButton m_Start;
  48. CButton m_Stop;
  49. CEdit m_Address;
  50. CEdit m_ConnID;
  51. CButton m_DisConn;
  52. private:
  53. static const USHORT PORT;
  54. static const LPCTSTR ADDRESS;
  55. EnAppState m_enState;
  56. CString m_strAddress;
  57. static CServerDlg* m_spThis;
  58. HP_TcpPackServer m_pServer;
  59. HP_TcpServerListener m_pListener;
  60. };