From 02b8e744139f3fa46b68ee6b9778fff433fe771b Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 13:05:56 +0000 Subject: Utilisateur : Fcolin Date : 23/09/05 Heure : 15:27 Archivé dans $/Bus/Ivy Commentaire: (vss 10) --- Bus/Ivy/ThreadedSocket.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Bus') diff --git a/Bus/Ivy/ThreadedSocket.h b/Bus/Ivy/ThreadedSocket.h index 85262cd..ad33c3e 100644 --- a/Bus/Ivy/ThreadedSocket.h +++ b/Bus/Ivy/ThreadedSocket.h @@ -29,11 +29,11 @@ public: // Operations public: - int Socket(int nSocketType=SOCK_STREAM, int nProtocolType = 0, int nAddressFormat = PF_INET); + SOCKET Socket(int nSocketType=SOCK_STREAM, int nProtocolType = 0, int nAddressFormat = PF_INET); int AddMember( const char * lpszHostAddress ); - virtual int Accept(CThreadedSocket& rConnectedSocket, + virtual SOCKET Accept(CThreadedSocket& rConnectedSocket, SOCKADDR* lpSockAddr = NULL, int* lpSockAddrLen = NULL); int Bind(unsigned int nSocketPort, const char * lpszSocketAddress = 0); @@ -44,16 +44,16 @@ public: int Connect(const SOCKADDR* lpSockAddr, int nSockAddrLen); int Listen(int nConnectionBacklog=5); - virtual int Receive(void* lpBuf, int nBufLen, int nFlags = 0); + virtual size_t Receive(void* lpBuf, size_t nBufLen, int nFlags = 0); - int ReceiveFrom(void* lpBuf, int nBufLen, + size_t ReceiveFrom(void* lpBuf, size_t nBufLen, ivy::string & rSocketAddress, unsigned int & rSocketPort, int nFlags = 0); enum { receives = 0, sends = 1, both = 2 }; - virtual int Send(const void* lpBuf, int nBufLen, int nFlags = 0); + virtual size_t Send(const void* lpBuf, size_t nBufLen, int nFlags = 0); - int SendTo(const void* lpBuf, int nBufLen, + size_t SendTo(const void* lpBuf, size_t nBufLen, unsigned int nHostPort, const char * lpszHostAddress = 0, int nFlags = 0); @@ -86,18 +86,20 @@ inline int IOCtl(long lCommand, unsigned long* lpArgument) return ioctlsocket(m_hSocket, lCommand, lpArgument); } -inline int ReceiveFrom(void* lpBuf, int nBufLen, SOCKADDR* lpSockAddr, int* lpSockAddrLen, int nFlags = 0) +inline size_t ReceiveFrom(void* lpBuf, size_t nBufLen, SOCKADDR* lpSockAddr, size_t* lpSockAddrLen, int nFlags = 0) { - int lg = recvfrom(m_hSocket, (LPSTR)lpBuf, nBufLen, nFlags, lpSockAddr, lpSockAddrLen); + int len = (int)*lpSockAddrLen; // Non conforme a Unix + size_t lg = recvfrom(m_hSocket, (LPSTR)lpBuf, (int)nBufLen, nFlags, lpSockAddr, &len); + *lpSockAddrLen = len; return lg; } inline int ShutDown(int nHow = sends) { return shutdown(m_hSocket,nHow); } -inline int SendTo(const void* lpBuf, int nBufLen, const SOCKADDR* lpSockAddr, int nSockAddrLen, int nFlags = 0) +inline size_t SendTo(const void* lpBuf, size_t nBufLen, const SOCKADDR* lpSockAddr, size_t nSockAddrLen, int nFlags = 0) { - return sendto(m_hSocket, (LPSTR)lpBuf, nBufLen, nFlags, lpSockAddr, nSockAddrLen); + return sendto(m_hSocket, (LPSTR)lpBuf, (int)nBufLen, nFlags, lpSockAddr, (int)nSockAddrLen); } -- cgit v1.1