From 4478d1300e93007c997a646c50aab576d5db0a69 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Feb 2016 14:18:03 +0100 Subject: [PATCH] WinCe platform modifications. --- lib/libwebsockets.c | 4 ++++ lib/lws-plat-win.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 7ebc0f694..65efd7e65 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -20,7 +20,11 @@ */ #include "private-libwebsockets.h" + +#ifndef _WIN32_WCE #include +#endif + #if defined(WIN32) || defined(_WIN32) #else #include diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c index cec976668..428ae7cd1 100644 --- a/lib/lws-plat-win.c +++ b/lib/lws-plat-win.c @@ -271,7 +271,10 @@ lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd) u_long optl = 1; DWORD dwBytesRet; struct tcp_keepalive alive; + int protonbr; +#ifndef _WIN32_WCE struct protoent *tcp_proto; +#endif if (context->ka_time) { /* enable keepalive on this socket */ @@ -293,15 +296,16 @@ lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd) optval = 1; #ifndef _WIN32_WCE tcp_proto = getprotobyname("TCP"); -#else - tcp_proto = 6; -#endif if (!tcp_proto) { lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO); return 1; } + protonbr = tcp_proto->p_proto; +#else + protonbr = 6; +#endif - setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, (const char *)&optval, optlen); + setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen); /* We are nonblocking... */ ioctlsocket(fd, FIONBIO, &optl);