diff --git a/gio/tests/socket.c b/gio/tests/socket.c index 064202d11..a3f3c43cb 100644 --- a/gio/tests/socket.c +++ b/gio/tests/socket.c @@ -829,6 +829,10 @@ test_ip_sync_dgram_timeouts (GSocketFamily family) GCancellable *cancellable = NULL; GThread *cancellable_thread = NULL; gssize len; +#ifdef G_OS_WIN32 + GInetAddress *iaddr; + GSocketAddress *addr; +#endif client = g_socket_new (family, G_SOCKET_TYPE_DATAGRAM, @@ -840,6 +844,16 @@ test_ip_sync_dgram_timeouts (GSocketFamily family) g_assert_cmpint (g_socket_get_socket_type (client), ==, G_SOCKET_TYPE_DATAGRAM); g_assert_cmpint (g_socket_get_protocol (client), ==, G_SOCKET_PROTOCOL_DEFAULT); +#ifdef G_OS_WIN32 + /* Winsock can't recv() on unbound udp socket */ + iaddr = g_inet_address_new_loopback (family); + addr = g_inet_socket_address_new (iaddr, 0); + g_object_unref (iaddr); + g_socket_bind (client, addr, TRUE, &error); + g_object_unref (addr); + g_assert_no_error (error); +#endif + /* No overall timeout: test the per-operation timeouts instead. */ g_socket_set_timeout (client, 0);