summaryrefslogtreecommitdiff
path: root/Ivy/ThreadedSocket.h
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:05:46 +0000
committerfcolin2007-02-01 13:05:46 +0000
commit1216a6d96c4aa7e76f6999ea39d49d3f444674ac (patch)
tree86a55e27bb361cbbef39f66af4ca4bae93358644 /Ivy/ThreadedSocket.h
parent3ac6d4f575306385ad90fce0a22901afa301132e (diff)
downloadivy-cplusplus-1216a6d96c4aa7e76f6999ea39d49d3f444674ac.zip
ivy-cplusplus-1216a6d96c4aa7e76f6999ea39d49d3f444674ac.tar.gz
ivy-cplusplus-1216a6d96c4aa7e76f6999ea39d49d3f444674ac.tar.bz2
ivy-cplusplus-1216a6d96c4aa7e76f6999ea39d49d3f444674ac.tar.xz
Utilisateur : Fcolin Date : 31/01/01 Heure : 11:18 Archivé dans $/Ivy (vss 5)
Diffstat (limited to 'Ivy/ThreadedSocket.h')
-rw-r--r--Ivy/ThreadedSocket.h27
1 files changed, 8 insertions, 19 deletions
diff --git a/Ivy/ThreadedSocket.h b/Ivy/ThreadedSocket.h
index bcdf8e5..829c562 100644
--- a/Ivy/ThreadedSocket.h
+++ b/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_)