home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / advanced / chatsrvr / srvrdoc.h < prev    next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  70 lines

  1. // srvrdoc.h : interface of the CServerDoc class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "lstnsock.h"
  14. #include "clntsock.h"
  15.  
  16. class CMsg;
  17.  
  18. class CServerDoc : public CDocument
  19. {
  20. protected: // create from serialization only
  21.     CServerDoc();
  22.     DECLARE_DYNCREATE(CServerDoc)
  23.  
  24. // Attributes
  25. public:
  26.     CListeningSocket* m_pSocket;
  27.     CStringList m_msgList;
  28.     CPtrList m_connectionList;
  29.  
  30. // Operations
  31. public:
  32.     void UpdateClients();
  33.     void ProcessPendingAccept();
  34.     void ProcessPendingRead(CClientSocket* pSocket);
  35.     CMsg* AssembleMsg(CClientSocket* pSocket);
  36.     CMsg* ReadMsg(CClientSocket* pSocket);
  37.     void SendMsg(CClientSocket* pSocket, CMsg* pMsg);
  38.     void CloseSocket(CClientSocket* pSocket);
  39.     void Message(LPCTSTR lpszMessage);
  40.  
  41. // Overrides
  42.     // ClassWizard generated virtual function overrides
  43.     //{{AFX_VIRTUAL(CServerDoc)
  44.     public:
  45.     virtual BOOL OnNewDocument();
  46.     virtual void DeleteContents();
  47.     //}}AFX_VIRTUAL
  48.  
  49. // Implementation
  50. public:
  51.     virtual ~CServerDoc();
  52.     virtual void Serialize(CArchive& ar);   // overridden for document i/o
  53. #ifdef _DEBUG
  54.     virtual void AssertValid() const;
  55.     virtual void Dump(CDumpContext& dc) const;
  56. #endif
  57.  
  58. protected:
  59.  
  60. // Generated message map functions
  61. protected:
  62.     //{{AFX_MSG(CServerDoc)
  63.     //}}AFX_MSG
  64.     afx_msg void OnUpdateMessages(CCmdUI* pCmdUI);
  65.     afx_msg void OnUpdateConnections(CCmdUI* pCmdUI);
  66.     DECLARE_MESSAGE_MAP()
  67. };
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70.