diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-02-20 21:00:36 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-02-20 21:00:36 +0000 |
commit | eef2845d1a065b9307c1e81cbd2e9549fdf8f9a7 (patch) | |
tree | 429ba25af35656fb942f889e9e091aac4f357d8c /cppe/src/IceE/Network.cpp | |
parent | Fix (diff) | |
download | ice-eef2845d1a065b9307c1e81cbd2e9549fdf8f9a7.tar.bz2 ice-eef2845d1a065b9307c1e81cbd2e9549fdf8f9a7.tar.xz ice-eef2845d1a065b9307c1e81cbd2e9549fdf8f9a7.zip |
Socket timeout fixes for Win32
Diffstat (limited to 'cppe/src/IceE/Network.cpp')
-rw-r--r-- | cppe/src/IceE/Network.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cppe/src/IceE/Network.cpp b/cppe/src/IceE/Network.cpp index d083b95db70..5bcf5640307 100644 --- a/cppe/src/IceE/Network.cpp +++ b/cppe/src/IceE/Network.cpp @@ -349,10 +349,15 @@ void IceInternal::setTimeout(SOCKET fd, bool recv, int timeout) { assert(timeout != 0); +#ifndef _WIN32 struct timeval tv; tv.tv_sec = timeout > 0 ? timeout / 1000 : 0; tv.tv_usec = timeout > 0 ? (timeout - tv.tv_sec * 1000) * 1000 : 0; if(setsockopt(fd, SOL_SOCKET, recv ? SO_RCVTIMEO : SO_SNDTIMEO, (char*)&tv, (int)sizeof(timeval)) == SOCKET_ERROR) +#else + int tt = timeout > 0 ? timeout : 0; + if(setsockopt(fd, SOL_SOCKET, recv ? SO_RCVTIMEO : SO_SNDTIMEO, (char*)&tt, (int)sizeof(int)) == SOCKET_ERROR) +#endif { closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); |