1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

WinCe platform modifications.

This commit is contained in:
unknown 2016-02-29 14:18:03 +01:00
parent bcd21bf190
commit 4478d1300e
2 changed files with 12 additions and 4 deletions

View file

@ -20,7 +20,11 @@
*/
#include "private-libwebsockets.h"
#ifndef _WIN32_WCE
#include <sys/types.h>
#endif
#if defined(WIN32) || defined(_WIN32)
#else
#include <sys/wait.h>

View file

@ -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);