#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
+#include <stdio.h>
#include <catta/log.h>
{
static char buf[256];
+ int err = WSAGetLastError();
+ int len = snprintf(buf, sizeof(buf), "[%i] ", err);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, WSAGetLastError(), 0, buf, sizeof(buf), NULL);
+ NULL, err, 0, buf + len, sizeof(buf) - len, NULL);
return buf;
}
msg.msg_iovlen = 1;
msg.msg_flags = 0;
+// TODO: don't ask me why, but Win8.1 64bit WSASendMsg() fails with an InvalidArgument error 10022 when IPv6 source address is specified ( everHannes / hannes.ahrens@everbase.net )
+#ifdef _WIN32
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+#else
if (iface > 0 || src_address) {
struct in6_pktinfo *pkti;
msg.msg_control = NULL;
msg.msg_controllen = 0;
}
+#endif
return sendmsg_loop(fd, &msg, 0);
}