From c7ada32fc5a6ffc9f588bfecd45499934066760b Mon Sep 17 00:00:00 2001 From: mjjo Date: Sat, 20 Jul 2013 23:23:10 +0000 Subject: [PATCH] --- HookMsg/ZXSocket.h | 101 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 HookMsg/ZXSocket.h diff --git a/HookMsg/ZXSocket.h b/HookMsg/ZXSocket.h new file mode 100644 index 0000000..de7ad5e --- /dev/null +++ b/HookMsg/ZXSocket.h @@ -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