X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/fc0f17db91f32c7504756e92a411a60d2ef0e264..ae0500e538e2fb821ef1ad8529aed7999acf7a19:/unix/uxnet.c diff --git a/unix/uxnet.c b/unix/uxnet.c index 1e7d51b7..08fb4e17 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -378,7 +378,7 @@ Socket sk_register(OSSocket sockfd, Plug plug) } Socket sk_new(SockAddr addr, int port, int privport, int oobinline, - int nodelay, Plug plug) + int nodelay, int keepalive, Plug plug) { int s; #ifdef IPV6 @@ -433,6 +433,11 @@ Socket sk_new(SockAddr addr, int port, int privport, int oobinline, setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, sizeof(b)); } + if (keepalive) { + int b = TRUE; + setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *) &b, sizeof(b)); + } + /* * Bind to local address. */