From e0e1e3b6f4735afefeeb0608f678c45274e3e066 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Mon, 31 Oct 2022 19:28:22 +0100 Subject: [PATCH] - fixed bug in windows UDP socket implementation (WSA was not started) (LIB61850-360) --- .../r_goose_publisher_example/r_goose_publisher_example.c | 3 +++ hal/socket/win32/socket_win32.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/examples/r_goose_publisher_example/r_goose_publisher_example.c b/examples/r_goose_publisher_example/r_goose_publisher_example.c index d55ae993..0434c343 100644 --- a/examples/r_goose_publisher_example/r_goose_publisher_example.c +++ b/examples/r_goose_publisher_example/r_goose_publisher_example.c @@ -96,6 +96,9 @@ main(int argc, char **argv) LinkedList_destroyDeep(dataSetValues, (LinkedListValueDeleteFunction) MmsValue_delete); } + else { + printf("Failed to create RSession instance\n"); + } return 0; } diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index db799c7e..f50ac05a 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -21,6 +21,8 @@ #include "hal_socket.h" #include "stack_config.h" +#define DEBUG_SOCKET 1 + #ifndef __MINGW64_VERSION_MAJOR struct tcp_keepalive { u_long onoff; @@ -671,6 +673,9 @@ Socket_destroy(Socket self) static UdpSocket UdpSocket_createUsingNamespace(int ns) { + if (wsaStartUp() == false) + return NULL; + UdpSocket self = NULL; SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);