diff --git a/src/win/tcp.c b/src/win/tcp.c index 485d93da..662090d0 100644 --- a/src/win/tcp.c +++ b/src/win/tcp.c @@ -71,7 +71,7 @@ static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsign if (enable && setsockopt(socket, IPPROTO_TCP, - SO_KEEPALIVE, + TCP_KEEPALIVE, (const char*)&delay, sizeof delay) == -1) { uv__set_sys_error(handle->loop, errno); diff --git a/src/win/winsock.h b/src/win/winsock.h index beee0321..433ce476 100644 --- a/src/win/winsock.h +++ b/src/win/winsock.h @@ -37,6 +37,10 @@ # define SO_UPDATE_CONNECT_CONTEXT 0x7010 #endif +#ifndef TCP_KEEPALIVE +# define TCP_KEEPALIVE 3 +#endif + #ifndef IPV6_V6ONLY #define IPV6_V6ONLY 27 #endif