I detected an error in SocketImpl when opening a socket using MAC with 64 bit (Darwin Kernel 10.7.3). In SocketImpl.cpp, the system function ::ioctl() is called from a method of the class SocketImpl with the same name, i.e. from SocketImpl::ioctl(). However, the method expects an 'int' value as a first argument, whereas the system function on my machine expects an 'unsigned long'. This has the effect that when sending a request via ioctl, in my case it was FIONBIO to toggle between blocking and non-blocking, the long integer gets wrapped into a normal integer, resulting in a negative value. This of course causes an error and an exception is thrown (with a not very clarifying message). I could solve the problem by changing the type of the argument 'request' of all class methods called SocketImpl::ioctl() from 'int' to 'unsigned long', i.e. I did that in SocketImpl.cpp and in the header file SocketImpl.h.