MyUdpSocket.h
上传用户:deligs
上传日期:2007-01-08
资源大小:43k
文件大小:2k
源码类别:

网络编程

开发平台:

Visual C++

  1. #if !defined(AFX_MYUDPSOCKET_H__55CD9CE1_83D8_11D4_974C_0080C8F60D90__INCLUDED_)
  2. #define AFX_MYUDPSOCKET_H__55CD9CE1_83D8_11D4_974C_0080C8F60D90__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // MyUdpSocket.h : header file
  7. //
  8. #include "LogIt.h"
  9. #include "MyUdpInfo.h"
  10. #define DEFAULT_IP "127.0.0.1"
  11. #define DEFAULT_CLIENTNAME "No Name"
  12. #define EVENT_UDP_CONNECTED 0x2000
  13. #define TIME_BETWEEN_RECEIVE 1000
  14. #define STAT_MYUDPC_SENDFIRST 0x5001
  15. #define STAT_MYUDPC_SENDSECOND 0x5002
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMyUdpSocket command target
  18. class CMyUdpSocket : public CAsyncSocket
  19. {
  20. // Attributes
  21. public:
  22. CString m_csAddress;
  23. CString m_csClientName;
  24. UINT m_uRemotePort;
  25. UINT m_uLocalPort;
  26. HWND m_hwndNotify;
  27. CLogIt* m_pLogFile;
  28. CMyUdpInfo* m_pMyUdpInfo;
  29. DWORD m_dwState;
  30. CString m_csModuleName;
  31. // Operations
  32. public:
  33. CMyUdpSocket();
  34. virtual ~CMyUdpSocket();
  35. BOOL Initial();
  36. void SendFirstPacket();
  37. private:
  38. BOOL ChecksumValid();
  39. // Overrides
  40. public:
  41. // ClassWizard generated virtual function overrides
  42. //{{AFX_VIRTUAL(CMyUdpSocket)
  43. public:
  44. virtual void OnReceive(int nErrorCode);
  45. //}}AFX_VIRTUAL
  46. // Generated message map functions
  47. //{{AFX_MSG(CMyUdpSocket)
  48. // NOTE - the ClassWizard will add and remove member functions here.
  49. //}}AFX_MSG
  50. // Implementation
  51. protected:
  52. };
  53. /////////////////////////////////////////////////////////////////////////////
  54. //{{AFX_INSERT_LOCATION}}
  55. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  56. #endif // !defined(AFX_MYUDPSOCKET_H__55CD9CE1_83D8_11D4_974C_0080C8F60D90__INCLUDED_)