//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 10/11/2003 // PROJECT: // SUBSYSTEM: // FILE: LgSocketClient.h // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Header file of LgSocketClient.h //---------------------------------------------------------------------------- #ifndef __LG__SOCKET__CLIENT__H__INCLUDED__ #define __LG__SOCKET__CLIENT__H__INCLUDED__ #if _MSC_VER > 1000 #pragma once #endif #include "LgSocket.h" template class CLgSocketClient : public BASE_SOCKET { public: CLgSocketClient() { } virtual ~CLgSocketClient() { Destroy(); } public: BOOL Create( LPCTSTR lpszHostAddress, UINT nHostPort ) { // create socket if( !BASE_SOCKET::Create() ) return FALSE; // establish connection with server if( !BASE_SOCKET::Connect( lpszHostAddress, nHostPort ) ) { DWORD dwError = GetLastError(); switch( dwError ) { case WSAEWOULDBLOCK: break; default: return FALSE; } } return TRUE; } virtual void Destroy() { Close(); } public: //{{AFX_VIRTUAL(CLgSocketClient) //}}AFX_VIRTUAL //{{AFX_MSG(CLgSocketClient) //}}AFX_MSG }; //{{AFX_INSERT_LOCATION}} #endif