]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/streamsocket.cpp
Use the correct #ifdef for Windows
[libs/net.git] / source / net / streamsocket.cpp
index 85f2b00a05d33e7820a022f6bb0e83716d0829f5..da5069cee21603110213dcfd3bf6ecc3904ae2ab 100644 (file)
@@ -1,4 +1,4 @@
-#ifdef WIN32
+#ifdef _WIN32
 #include <winsock2.h>
 #else
 #include <sys/socket.h>
@@ -18,7 +18,7 @@ namespace Net {
 StreamSocket::StreamSocket(const Private &p, const SockAddr &paddr):
        ClientSocket(p, paddr)
 {
-#ifdef WIN32
+#ifdef _WIN32
        WSAEventSelect(priv->handle, *priv->event, FD_READ|FD_CLOSE);
 #endif
        set_events(IO::P_INPUT);
@@ -36,7 +36,7 @@ bool StreamSocket::connect(const SockAddr &addr)
        SockAddr::SysAddr sa = addr.to_sys();
 
        int err = ::connect(priv->handle, reinterpret_cast<sockaddr *>(&sa.addr), sa.size);
-#ifdef WIN32
+#ifdef _WIN32
        if(err==SOCKET_ERROR)
        {
                int err_code = WSAGetLastError();
@@ -73,7 +73,7 @@ bool StreamSocket::connect(const SockAddr &addr)
        if(err==0)
        {
                connected = true;
-#ifdef WIN32
+#ifdef _WIN32
                WSAEventSelect(priv->handle, *priv->event, FD_READ|FD_CLOSE);
 #endif
                set_events(IO::P_INPUT);
@@ -100,14 +100,14 @@ bool StreamSocket::poll_connect(const Time::TimeDelta &timeout)
                if(err!=0)
                {
                        set_events(IO::P_NONE);
-#ifdef WIN32
+#ifdef _WIN32
                        throw system_error("connect", WSAGetLastError());
 #else
                        throw system_error("connect");
 #endif
                }
 
-#ifdef WIN32
+#ifdef _WIN32
                WSAEventSelect(priv->handle, *priv->event, FD_READ|FD_CLOSE);
 #endif
                set_events(IO::P_INPUT);
@@ -142,7 +142,7 @@ void StreamSocket::on_event(IO::PollEvent ev)
                        peer_addr = 0;
                }
 
-#ifdef WIN32
+#ifdef _WIN32
                WSAEventSelect(priv->handle, *priv->event, FD_READ|FD_CLOSE);
 #endif
                set_events((err==0) ? IO::P_INPUT : IO::P_NONE);