This commit is contained in:
101
ZXSocket.h
Normal file
101
ZXSocket.h
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 1997-1999 by Bitek System Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// ZXSocket.h : implementation of the CZXSocket class.
|
||||||
|
//
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DESCRIPTION
|
||||||
|
//
|
||||||
|
// CZXSocket class
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _ZXSOCKET_H
|
||||||
|
#define _ZXSOCKET_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CZXSocket
|
||||||
|
//
|
||||||
|
|
||||||
|
#define ZXFAILURE FALSE
|
||||||
|
#define ZXSUCCESS TRUE
|
||||||
|
|
||||||
|
|
||||||
|
class CZXSocket
|
||||||
|
{
|
||||||
|
////////////////////////////////////////
|
||||||
|
// Public Members :
|
||||||
|
//
|
||||||
|
|
||||||
|
// Constructor & Destructor
|
||||||
|
public:
|
||||||
|
CZXSocket(int nConnectTimeout = 10, int nReadTimeout = 10, int nWriteTimeout = 10);
|
||||||
|
virtual ~CZXSocket();
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
void SetConnectTimeout(int nConnectTimeout);
|
||||||
|
void SetReadTimeout(int nReadTimeout);
|
||||||
|
void SetWriteTimeout(int nWriteTimeout);
|
||||||
|
BOOL HasConnectionDropped( void );
|
||||||
|
|
||||||
|
int Open( BOOL bServerMode );
|
||||||
|
int Close();
|
||||||
|
|
||||||
|
int Bind(LPCTSTR lpszServer, int nPort);
|
||||||
|
int Listen(int nBackLog);
|
||||||
|
int Connect(LPCTSTR lpszServer, int nPort);
|
||||||
|
int Accept(CZXSocket* lpConnectedSocket);
|
||||||
|
|
||||||
|
int GetSockName(LPTSTR* lppszSocketAddress, int* lpnSocketPort);
|
||||||
|
/***
|
||||||
|
int GetSockAddr(LPSOCKADDR lpSockAddr, int* lpSockAddrLen);
|
||||||
|
***/
|
||||||
|
|
||||||
|
int ReadBytes(LPSTR lpszBuffer, int nLength);
|
||||||
|
int WriteBytes(LPCSTR lpszBuffer, int nLength);
|
||||||
|
|
||||||
|
int ReadLine(LPTSTR lpszLine, int nLength);
|
||||||
|
int WriteLine(LPCTSTR lpszLine);
|
||||||
|
|
||||||
|
// Overridables
|
||||||
|
public:
|
||||||
|
BOOL IsConnected() { return m_bConnected; }
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
// Protected Members :
|
||||||
|
//
|
||||||
|
|
||||||
|
// Define
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
protected:
|
||||||
|
SOCKET m_nSocket;
|
||||||
|
|
||||||
|
TCHAR m_szConnectedServer[40];
|
||||||
|
int m_nConnectedPort;
|
||||||
|
BOOL m_bConnected;
|
||||||
|
|
||||||
|
int m_nConnectTimeout;
|
||||||
|
int m_nReadTimeout;
|
||||||
|
int m_nWriteTimeout;
|
||||||
|
|
||||||
|
BOOL m_bCancel;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Overridables
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user