-#include <iostream>
#include "platform_api.h"
+#include "socket.h"
+#include <iostream>
#include <msp/core/systemerror.h>
#include <msp/io/handle_private.h>
#include "sockaddr_private.h"
-#include "socket.h"
#include "socket_private.h"
+using namespace std;
+
namespace {
class WinSockHelper
}
};
-WinSockHelper wsh;
+unique_ptr<WinSockHelper> wsh;
}
void Socket::platform_init()
{
+ if(!wsh)
+ wsh = make_unique<WinSockHelper>();
*priv->event = CreateEvent(0, false, false, 0);
}
ioctlsocket(handle, FIONBIO, &flag);
}
+void Socket::Private::set_inherit(bool)
+{
+}
+
int Socket::Private::set_option(int level, int optname, const void *optval, socklen_t optlen)
{
return setsockopt(handle, level, optname, reinterpret_cast<const char *>(optval), optlen);
}
-unsigned check_sys_error(int ret, const char *func)
+size_t check_sys_error(make_signed<size_t>::type ret, const char *func)
{
if(ret<0)
{