diff options
Diffstat (limited to 'Bus/Ivy')
-rw-r--r-- | Bus/Ivy/ThreadedSocket.h | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/Bus/Ivy/ThreadedSocket.h b/Bus/Ivy/ThreadedSocket.h index bcdf8e5..829c562 100644 --- a/Bus/Ivy/ThreadedSocket.h +++ b/Bus/Ivy/ThreadedSocket.h @@ -2,25 +2,19 @@ //
//////////////////////////////////////////////////////////////////////
-#if !defined(AFX_THREADEDSOCKET_H__DC45EFD8_343F_11D3_8A15_00A0245B298A__INCLUDED_)
-#define AFX_THREADEDSOCKET_H__DC45EFD8_343F_11D3_8A15_00A0245B298A__INCLUDED_
-#if _MSC_VER > 1000
#pragma once
-#endif // _MSC_VER > 1000
-#include <winsock2.h>
-
-class CThreadedSocketException //: public CException
+class CThreadedSocketException
{
-// DECLARE_DYNAMIC(CThreadedSocketException)
+
public:
// Constructor
CThreadedSocketException(char* pchMessage);
public:
~CThreadedSocketException() {}
- virtual bool GetErrorMessage(String& lpstrError, unsigned int nMaxError,
+ virtual bool GetErrorMessage(string& lpstrError, unsigned int nMaxError,
unsigned int * pnHelpContext = 0);
int GetError() { return m_nError; };
private:
@@ -28,11 +22,8 @@ private: char * m_strMessage;
};
-class CThreadedSocket //: public CObject
+class CThreadedSocket
{
-// DECLARE_DYNAMIC(CThreadedSocket);
-// typedef unsigned int SOCKET;
-// typedef struct sockaddr SOCKADDR;
public:
CThreadedSocket();
@@ -49,9 +40,9 @@ public: operator SOCKET() const;
- void GetPeerName(String & rPeerAddress, unsigned int& rPeerPort);
+ void GetPeerName(string & rPeerAddress, unsigned int& rPeerPort);
- void GetSockName(String & rSocketAddress, unsigned int& rSocketPort);
+ void GetSockName(string & rSocketAddress, unsigned int& rSocketPort);
// Operations
public:
@@ -74,7 +65,7 @@ public: virtual int Receive(void* lpBuf, int nBufLen, int nFlags = 0);
int ReceiveFrom(void* lpBuf, int nBufLen,
- String & rSocketAddress, unsigned int & rSocketPort, int nFlags = 0);
+ string & rSocketAddress, unsigned int & rSocketPort, int nFlags = 0);
enum { receives = 0, sends = 1, both = 2 };
@@ -91,7 +82,7 @@ inline CThreadedSocket::operator SOCKET() const inline void GetPeerName(SOCKADDR* lpSockAddr, int* lpSockAddrLen)
{
if ( getpeername(m_hSocket, lpSockAddr, lpSockAddrLen) == SOCKET_ERROR)
- throw( new CThreadedSocketException( "getpeername" ) );
+ throw ( new CThreadedSocketException( "getpeername" ) );
}
inline void GetSockName(SOCKADDR* lpSockAddr, int* lpSockAddrLen)
{ if ( getsockname(m_hSocket, lpSockAddr, lpSockAddrLen)== SOCKET_ERROR)
@@ -166,5 +157,3 @@ protected: static DWORD WINAPI SocketThreadProc( void * pParam );
};
-
-#endif // !defined(AFX_THREADEDSOCKET_H__DC45EFD8_343F_11D3_8A15_00A0245B298A__INCLUDED_)
|