diff options
-rw-r--r-- | stream/tcp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/stream/tcp.c b/stream/tcp.c index c9ffc89b47..425598465e 100644 --- a/stream/tcp.c +++ b/stream/tcp.c @@ -86,6 +86,13 @@ connect2Server_with_af(char *host, int port, int af,int verb) { return TCP_ERROR_FATAL; } +#if defined SO_RCVTIMEO && defined SO_SNDTIMEO + tv.tv_sec = 10; + tv.tv_usec = 0; + setsockopt(socket_server_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + setsockopt(socket_server_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)); +#endif + switch (af) { case AF_INET: our_s_addr = (void *) &server_address.four.sin_addr; break; #ifdef HAVE_AF_INET6 |