diff --git a/StockServer/ServerSocket.h b/StockServer/ServerSocket.h new file mode 100644 index 0000000..f039f1c --- /dev/null +++ b/StockServer/ServerSocket.h @@ -0,0 +1,73 @@ +#if !defined(AFX_SERVERSOCKET_H__B23B4D6D_E7F8_4DAB_ACC4_E7E8C444446A__INCLUDED_) +#define AFX_SERVERSOCKET_H__B23B4D6D_E7F8_4DAB_ACC4_E7E8C444446A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ServerSocket.h : header file +// + +class CClientSocket; +class CComData; +class CMainFrame; + +///////////////////////////////////////////////////////////////////////////// +// CServerSocket command target + +class CServerSocket : public CSocket +{ + +// Attributes +public: + +private: + CMainFrame* m_pMainFrame; + int m_nMaxClients; + CPtrList m_ClientstList; + +// Operations +public: + CServerSocket(CMainFrame* pMainFrame); + virtual ~CServerSocket(); + + void ProcessClientCom(CClientSocket* pClientSocket); + BOOL BeginListening(UINT uPort, int nMaxClients); + int GetClientsConnectedCount(); + int GetTotalMessagesCount(); + CPtrList* GetClientsList(); + void SendMessageTo(CString szClient, CString szMessage); + +private: + void SendSignChange(CClientSocket* pClientSocket, CString strNewId); + BOOL CheckAlive(CClientSocket* pClientSocket, int nCheck=2); + + void ProcessAccept(); + BOOL IsThisLoginBeingUsed(CClientSocket* pClientSocket, CComData* pComData); + void UpdateClientsList(); + void UpdateClientsInfo(CComData* pComData, CClientSocket* pClientSocket); + void RemoveClient(CClientSocket* pClientSocket); + void CloseClients(); + +// Overrides +public: + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CServerSocket) + public: + virtual void OnAccept(int nErrorCode); + //}}AFX_VIRTUAL + + // Generated message map functions + //{{AFX_MSG(CServerSocket) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + +// Implementation +protected: +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_SERVERSOCKET_H__B23B4D6D_E7F8_4DAB_ACC4_E7E8C444446A__INCLUDED_)