diff options
author | fcolin | 2007-02-01 13:05:56 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 13:05:56 +0000 |
commit | 02b8e744139f3fa46b68ee6b9778fff433fe771b (patch) | |
tree | bc201eaa2b2292ed7aaffc3aeca0ca4d2fb23003 /Bus | |
parent | bad2b83c68fd1bce542082129b898e0b8c92d0a6 (diff) | |
download | ivy-cplusplus-02b8e744139f3fa46b68ee6b9778fff433fe771b.zip ivy-cplusplus-02b8e744139f3fa46b68ee6b9778fff433fe771b.tar.gz ivy-cplusplus-02b8e744139f3fa46b68ee6b9778fff433fe771b.tar.bz2 ivy-cplusplus-02b8e744139f3fa46b68ee6b9778fff433fe771b.tar.xz |
Utilisateur : Fcolin Date : 23/09/05 Heure : 15:27 Archivé dans $/Bus/Ivy Commentaire: (vss 10)
Diffstat (limited to 'Bus')
-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);
}
|