Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.7 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 09/11/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgSocketServerConnection.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of LgSocketServerConnection.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __LG__SOCKET__CONNECTION__H__INCLUDED__
  15. #define __LG__SOCKET__CONNECTION__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #include "LgSocket.h"
  20. template<class BASE_SOCKET>
  21. class CLgSocketServer;
  22. template<class BASE_SOCKET>
  23. class CLgSocketServerConnection :
  24. public BASE_SOCKET
  25. {
  26. public:
  27. CLgSocketServerConnection( CLgSocketServer<BASE_SOCKET>* pServer )
  28. {
  29. m_pServer = pServer;
  30. m_bDeletePending = FALSE;
  31. }
  32. virtual ~CLgSocketServerConnection() {}
  33. public:
  34. CLgSocketServer<BASE_SOCKET>* GetServer() { return m_pServer; }
  35. public:
  36. virtual void OnConnect( LPSOCKADDR_IN pSockAddr )
  37. {
  38. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLgSocketServerConnection<BASE_SOCKET>::OnConnect"), _T("%d.%d.%d.%d"), pSockAddr->sin_addr.S_un.S_un_b.s_b1, pSockAddr->sin_addr.S_un.S_un_b.s_b2, pSockAddr->sin_addr.S_un.S_un_b.s_b3, pSockAddr->sin_addr.S_un.S_un_b.s_b4 );
  39. }
  40. virtual void OnClose(int nErrorCode)
  41. {
  42. BASE_SOCKET::OnClose(nErrorCode);
  43. m_pServer->OnCloseConnection( this );
  44. }
  45. public:
  46. void DeletePending() { m_bDeletePending = TRUE; }
  47. BOOL IsDeletePending() { return m_bDeletePending; }
  48. private:
  49. CLgSocketServer<BASE_SOCKET> *m_pServer;
  50. private:
  51. BOOL m_bDeletePending;
  52. };
  53. #endif