From 280e36a572c772fd481457f6192ddd399e996961 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Mon, 11 Feb 2019 13:26:47 +0100 Subject: stunbdc: initialize Winsock API when on Windows --- stun/tools/stunbdc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/stun/tools/stunbdc.c b/stun/tools/stunbdc.c index 1d869fc..fd0f77f 100644 --- a/stun/tools/stunbdc.c +++ b/stun/tools/stunbdc.c @@ -130,6 +130,12 @@ int main (int argc, char *argv[]) const char *server = NULL, *port = NULL; int family = AF_UNSPEC; int i; + int result; + +#ifdef _WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif for (i = 1; i < argc; ++i) { @@ -182,5 +188,11 @@ int main (int argc, char *argv[]) return 2; } - return run (family, server, port) ? 1 : 0; + result = run (family, server, port) ? 1 : 0; + +#ifdef _WIN32 + WSACleanup(); +#endif + + return result; } -- cgit v1.2.1