From d7b58b3a05d811b7a088de52fdf5c98a0362453f Mon Sep 17 00:00:00 2001 From: dgis Date: Sun, 8 Dec 2019 23:44:42 +0100 Subject: [PATCH] Update the socket API. --- app/src/main/cpp/win32-layer.c | 18 +++++++++++++++++- app/src/main/cpp/win32-layer.h | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index e89e56e..045d849 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core/resource.h" #include "win32-layer.h" #include "emu.h" @@ -3062,4 +3063,19 @@ int WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) { int WSACleanup() { return 0; -} \ No newline at end of file +} + +int closesocket(SOCKET s) { + int err = shutdown(s, SHUT_RDWR); + err = close(s); +} + +int win32_select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, struct timeval* __timeout) { +// struct timeval timeout; +// if(__timeout == NULL) { +// timeout.tv_sec = 5; //0; +// timeout.tv_usec = 0; //500000; +// __timeout = &timeout; +// } + return select(__fd_count, __read_fds, __write_fds, __exception_fds, __timeout); +} diff --git a/app/src/main/cpp/win32-layer.h b/app/src/main/cpp/win32-layer.h index 60e3316..28a4fef 100644 --- a/app/src/main/cpp/win32-layer.h +++ b/app/src/main/cpp/win32-layer.h @@ -1349,4 +1349,7 @@ typedef struct WSAData { extern int WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData); extern int WSACleanup(); -typedef struct addrinfo ADDRINFO; \ No newline at end of file +typedef struct addrinfo ADDRINFO; + +extern int closesocket(SOCKET s); +