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.4 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: 10/11/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgSocketClient.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of LgSocketClient.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __LG__SOCKET__CLIENT__H__INCLUDED__
  15. #define __LG__SOCKET__CLIENT__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #include "LgSocket.h"
  20. template<class BASE_SOCKET>
  21. class CLgSocketClient :
  22. public BASE_SOCKET
  23. {
  24. public:
  25. CLgSocketClient() { }
  26. virtual ~CLgSocketClient() { Destroy(); }
  27. public:
  28. BOOL Create( LPCTSTR lpszHostAddress, UINT nHostPort )
  29. {
  30. // create socket
  31. if( !BASE_SOCKET::Create() )
  32. return FALSE;
  33. // establish connection with server
  34. if( !BASE_SOCKET::Connect( lpszHostAddress, nHostPort ) )
  35. {
  36. DWORD dwError = GetLastError();
  37. switch( dwError )
  38. {
  39. case WSAEWOULDBLOCK:
  40. break;
  41. default:
  42. return FALSE;
  43. }
  44. }
  45. return TRUE;
  46. }
  47. virtual void Destroy() { Close(); }
  48. public:
  49. //{{AFX_VIRTUAL(CLgSocketClient)
  50. //}}AFX_VIRTUAL
  51. //{{AFX_MSG(CLgSocketClient)
  52. //}}AFX_MSG
  53. };
  54. //{{AFX_INSERT_LOCATION}}
  55. #endif