[reSIProcate] Socket portability issue

Gregor Jasny jasny at vidsoft.de
Thu Dec 11 05:03:26 CST 2008


Hi,

I've stumbled across a Win32/Unix portability issue. In my source files 
I don't declare 'using namespace resip'. Because of the following code 
in Socket.hxx

namespace resip {

#ifndef WIN32
typedef int Socket;
static const Socket INVALID_SOCKET = -1;
static const int SOCKET_ERROR = -1;
inline int getErrno() { return errno; }
#else
typedef SOCKET Socket;
inline int getErrno() { return WSAGetLastError(); }
#endif

}

this results in SOCKET_ERROR living in the :: scope on Windows (there it 
is a plain define) and in the resip:: scope on non-Windows. I would 
suggest to either convert INVALID_SOCKET and SOCKET_ERROR to defines, 
too, or put a using resip::INVALID_SOCKET; using resip::SOCKET_ERROR; at 
the end of Socket.hxx.

Thanks,
Gregor



More information about the resiprocate-devel mailing list