+#ifdef WITH_IOSET_WIN32
+
+# undef errno
+# define errno WSAGetLastError()
+# undef EINPROGRESS
+# define EINPROGRESS WSAEINPROGRESS
+# undef EHOSTUNREACH
+# define EHOSTUNREACH WSAEHOSTUNREACH
+# undef ECONNREFUSED
+# define ECONNREFUSED WSAECONNREFUSED
+# undef EAGAIN
+# define EAGAIN WSAEWOULDBLOCK
+# define strerror wsa_strerror
+
+static const char *
+wsa_strerror(int wsa_err)
+{
+ switch (wsa_err)
+ {
+ case WSAEINTR: return "Operation interrupted";
+ case WSAEBADF: return "Bad file descriptor";
+ case WSAEACCES: return "Permission denied";
+ case WSAEFAULT: return "Invalid address";
+ case WSAEINVAL: return "Invalid parameter";
+ case WSAEMFILE: return "Too many open files";
+ case WSAEWOULDBLOCK: return "Try again later";
+ case WSAEINPROGRESS: return "Operation in progress";
+ case WSAEALREADY: return "Operation already in progress";
+ case WSAENOTSOCK: return "Not a socket";
+ case WSAEDESTADDRREQ: return "Destination address required";
+ case WSAEMSGSIZE: return "Invalid message size";
+ case WSAEPROTOTYPE: return "Invalid protocol type for socket";
+ case WSAENOPROTOOPT: return "Invalid protocol option";
+ case WSAEPROTONOSUPPORT: return "Protocol not supported";
+ case WSAEOPNOTSUPP: return "Operation not supported";
+ case WSAEADDRINUSE: return "Address already in use";
+ case WSAEADDRNOTAVAIL: return "Address not available";
+ case WSAENETDOWN: return "Network down";
+ case WSAENETUNREACH: return "Network unreachable";
+ case WSAENETRESET: return "Network reset";
+ case WSAECONNABORTED: return "Connection aborted";
+ case WSAECONNRESET: return "Connection reset by peer";
+ case WSAECONNREFUSED: return "Connection refused";
+ }
+ return "unknown error";
+}
+
+#endif /* WITH_IOSET_WIN32 */