summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Adam <jakub.adam@collabora.com>2019-02-11 13:26:47 +0100
committerJakub Adam <jakub.adam@collabora.com>2019-02-11 13:29:04 +0100
commit280e36a572c772fd481457f6192ddd399e996961 (patch)
treea72535ef296f1de795225ac5671963923f1fb1ef
parent602d48c4c9a593d149759ac90a78e6e9b3ed5e02 (diff)
downloadlibnice-280e36a572c772fd481457f6192ddd399e996961.tar.gz
stunbdc: initialize Winsock API when on Windows
-rw-r--r--stun/tools/stunbdc.c14
1 files changed, 13 insertions, 1 deletions
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;
}