diff --git a/nsock/tests/tests_main.c b/nsock/tests/tests_main.c index dfdf741..a7145e5 100644 --- a/nsock/tests/tests_main.c +++ b/nsock/tests/tests_main.c @@ -69,9 +69,25 @@ static int test_case_run(const struct test_case *test) { return test_teardown(test, tdata); } +#ifdef WIN32 +static int win_init(void) { + WSADATA data; + + rc = WSAStartup(MAKEWORD(1, 1), &data); + if (rc) + fatal ("Failed to start winsock: %s\n", socket_strerror(rc)); + + return 0; +} +#endif + int main(int ac, char **av) { int rc, i; +#ifdef WIN32 + win_init(); +#endif + for (i = 0; TestCases[i] != NULL; i++) { const struct test_case *current = TestCases[i]; const char *name = get_test_name(current);