aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tcp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tcp.c b/tcp.c
index f4af987..2cca739 100644
--- a/tcp.c
+++ b/tcp.c
@@ -226,6 +226,10 @@ int tcp_connect __P2 (char *,addr, int,port)
if (setsockopt(newtcp_fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt)))
errmsg("setsockopt(TCP_NODELAY) failed");
+ /* TCP keep-alive */
+ if (setsockopt(newtcp_fd, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt)))
+ errmsg("setsockopt(SO_KEEPALIVE) failed");
+
/*
* Then, close-on-exec:
* we don't want children to inherit the socket!