diff options
-rw-r--r-- | Bus/Ivy/ThreadedSocket.h | 22 |
1 files changed, 12 insertions, 10 deletions
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);
}
|