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.
|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 05/11/2003
// PROJECT:
// SUBSYSTEM:
// FILE: LgSocket.h
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Header file of LgSocket.h
//----------------------------------------------------------------------------
#ifndef __LG__SOCKET__H__INCLUDED__
#define __LG__SOCKET__H__INCLUDED__
#if _MSC_VER > 1000
#pragma once
#endif
#include "..\..\LgLib\Thread.h"
#include "..\Templ.h"
class CLgSocket : public CLgThread{public: CLgSocket(); virtual ~CLgSocket();
public: BOOL Create( UINT nSocketPort = 0, int nSocketType = SOCK_STREAM, long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE, LPCTSTR lpszSocketAddress = NULL );
public: SOCKET GetSocketHandle();
public: virtual void Close(); virtual BOOL Accept( CLgSocket& rConnectedSocket, SOCKADDR* lpSockAddr = NULL, int* lpSockAddrLen = NULL ); virtual int Send( const void* lpBuf, int nBufLen, int nFlags = 0 ); virtual int Receive( void* lpBuf, int nBufLen, int nFlags = 0 ); BOOL GetSockName( SOCKADDR* lpSockAddr, int* lpSockAddrLen ); BOOL AsyncSelect( long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE ); BOOL Listen( int nConnectionBacklog = 5 ); BOOL Connect( LPCTSTR lpszHostAddress, UINT nHostPort ); BOOL Connect( const SOCKADDR* lpSockAddr, int nSockAddrLen );
protected: virtual void OnAccept( int nErrorCode ); virtual void OnConnect( int nErrorCode ); virtual void OnClose( int nErrorCode ); virtual void OnOutOfBandData( int nErrorCode ); virtual void OnReceive( int nErrorCode ); virtual void OnSend( int nErrorCode );
protected: void DoHandleEvents(); HANDLE GetSocketEventHandle(); protected: virtual DWORD ThreadProc();
private: SOCKET m_hSocket; long m_lEventMask; HANDLE m_hSocketEvent;};
#endif
|