Index: include/common.h
===================================================================
--- include/common.h	(revision 90934)
+++ include/common.h	(working copy)
@@ -798,6 +798,7 @@
 #define HOUSEKEEPER_STARTUP_DELAY	30	/* in minutes */
 
 #define	GET_SENDER_TIMEOUT	60
+#define	GET_SENDER_TIMEOUT_STR	"60"
 
 #ifndef MAX
 #	define MAX(a, b) ((a) > (b) ? (a) : (b))
Index: src/zabbix_get/zabbix_get.c
===================================================================
--- src/zabbix_get/zabbix_get.c	(revision 90934)
+++ src/zabbix_get/zabbix_get.c	(working copy)
@@ -34,12 +34,13 @@
 const char	title_message[] = "zabbix_get";
 const char	syslog_app_name[] = "zabbix_get";
 const char	*usage_message[] = {
-	"-s host-name-or-IP", "[-p port-number]", "[-I IP-address]", "-k item-key", NULL,
+	"-s host-name-or-IP", "[-p port-number]", "[-I IP-address]", "[-u timeout]", "-k item-key", NULL,
 #if defined(HAVE_POLARSSL) || defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL)
-	"-s host-name-or-IP", "[-p port-number]", "[-I IP-address]", "--tls-connect cert", "--tls-ca-file CA-file",
-	"[--tls-crl-file CRL-file]", "[--tls-agent-cert-issuer cert-issuer]", "[--tls-agent-cert-subject cert-subject]",
-	"--tls-cert-file cert-file", "--tls-key-file key-file", "-k item-key", NULL,
-	"-s host-name-or-IP", "[-p port-number]", "[-I IP-address]", "--tls-connect psk",
+	"-s host-name-or-IP", "[-p port-number]", "[-I IP-address]", "[-u timeout]", "--tls-connect cert",
+	"--tls-ca-file CA-file", "[--tls-crl-file CRL-file]", "[--tls-agent-cert-issuer cert-issuer]",
+	"[--tls-agent-cert-subject cert-subject]", "--tls-cert-file cert-file", "--tls-key-file key-file",
+	"-k item-key", NULL,
+	"-s host-name-or-IP", "[-p port-number]", "[-I IP-address]", "[-u timeout]", "--tls-connect psk",
 	"--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "-k item-key", NULL,
 #endif
 	"-h", NULL,
@@ -57,6 +58,7 @@
 	"  -p --port port-number      Specify port number of agent running on the host",
 	"                             (default: " ZBX_DEFAULT_AGENT_PORT_STR ")",
 	"  -I --source-address IP-address   Specify source IP address",
+	"  -u --timeout seconds       Specify timeout in seconds (default: " GET_SENDER_TIMEOUT_STR ")",
 	"",
 	"  -k --key item-key          Specify key of the item to retrieve value for",
 	"",
@@ -145,6 +147,7 @@
 	{"port",			1,	NULL,	'p'},
 	{"key",				1,	NULL,	'k'},
 	{"source-address",		1,	NULL,	'I'},
+	{"timeout",			1,	NULL,	'u'},
 	{"help",			0,	NULL,	'h'},
 	{"version",			0,	NULL,	'V'},
 	{"tls-connect",			1,	NULL,	'1'},
@@ -160,7 +163,7 @@
 };
 
 /* short options */
-static char	shortopts[] = "s:p:k:I:hV";
+static char	shortopts[] = "s:p:k:I:u:hV";
 
 /* end of COMMAND LINE OPTIONS */
 
@@ -207,7 +210,8 @@
  *             key  - item's key                                              *
  *                                                                            *
  ******************************************************************************/
-static int	get_value(const char *source_ip, const char *host, unsigned short port, const char *key)
+static int	get_value(const char *source_ip, const char *host, unsigned short port, const char *key,
+		unsigned short timeout)
 {
 	zbx_socket_t	s;
 	int		ret;
@@ -235,7 +239,7 @@
 			return FAIL;
 	}
 
-	if (SUCCEED == (ret = zbx_tcp_connect(&s, source_ip, host, port, GET_SENDER_TIMEOUT,
+	if (SUCCEED == (ret = zbx_tcp_connect(&s, source_ip, host, port, timeout,
 			configured_tls_connect_mode, tls_arg1, tls_arg2)))
 	{
 		if (SUCCEED == (ret = zbx_tcp_send(&s, key)))
@@ -292,7 +296,7 @@
 {
 	int		i, ret = SUCCEED;
 	char		*host = NULL, *key = NULL, *source_ip = NULL, ch;
-	unsigned short	opt_count[256] = {0}, port = ZBX_DEFAULT_AGENT_PORT;
+	unsigned short	opt_count[256] = {0}, port = ZBX_DEFAULT_AGENT_PORT, timeout = GET_SENDER_TIMEOUT;
 #if defined(_WINDOWS)
 	char		*error = NULL;
 #endif
@@ -328,6 +332,9 @@
 				if (NULL == source_ip)
 					source_ip = zbx_strdup(NULL, zbx_optarg);
 				break;
+			case 'u':
+				timeout = (unsigned short)atoi(zbx_optarg);
+				break;
 			case 'h':
 				help();
 				exit(EXIT_SUCCESS);
@@ -461,7 +468,7 @@
 	signal(SIGALRM, get_signal_handler);
 	signal(SIGPIPE, get_signal_handler);
 #endif
-	ret = get_value(source_ip, host, port, key);
+	ret = get_value(source_ip, host, port, key, timeout);
 out:
 	zbx_free(host);
 	zbx_free(key);
Index: src/zabbix_sender/zabbix_sender.c
===================================================================
--- src/zabbix_sender/zabbix_sender.c	(revision 90934)
+++ src/zabbix_sender/zabbix_sender.c	(working copy)
@@ -36,37 +36,39 @@
 const char	syslog_app_name[] = "zabbix_sender";
 
 const char	*usage_message[] = {
-	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "-s host", "-k key", "-o value", NULL,
-	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-s host]", "[-T]", "[-r]", "-i input-file", NULL,
-	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "-k key", "-o value",
-	NULL,
+	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-u timeout]", "-s host", "-k key", "-o value", NULL,
+	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-s host]", "[-T]", "[-r]", "[-u timeout]",
+	"-i input-file", NULL,
+	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]",
+	"-k key", "-o value", NULL,
 	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "[-T]", "[-r]",
-	"-i input-file", NULL,
+	"[-u timeout]", "-i input-file", NULL,
 #if defined(HAVE_POLARSSL) || defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL)
-	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "-s host", "--tls-connect cert", "--tls-ca-file CA-file",
-	"[--tls-crl-file CRL-file]", "[--tls-server-cert-issuer cert-issuer]",
-	"[--tls-server-cert-subject cert-subject]", "--tls-cert-file cert-file", "--tls-key-file key-file", "-k key",
-	"-o value", NULL,
-	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-s host]", "--tls-connect cert", "--tls-ca-file CA-file",
-	"[--tls-crl-file CRL-file]", "[--tls-server-cert-issuer cert-issuer]",
-	"[--tls-server-cert-subject cert-subject]", "--tls-cert-file cert-file", "--tls-key-file key-file", "[-T]",
-	"[-r]", "-i input-file", NULL,
-	"[-v]", "-c config-file [-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "--tls-connect cert",
+	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-u timeout]", "-s host", "--tls-connect cert",
 	"--tls-ca-file CA-file", "[--tls-crl-file CRL-file]", "[--tls-server-cert-issuer cert-issuer]",
 	"[--tls-server-cert-subject cert-subject]", "--tls-cert-file cert-file", "--tls-key-file key-file", "-k key",
 	"-o value", NULL,
-	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "--tls-connect cert",
+	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]", "--tls-connect cert",
 	"--tls-ca-file CA-file", "[--tls-crl-file CRL-file]", "[--tls-server-cert-issuer cert-issuer]",
 	"[--tls-server-cert-subject cert-subject]", "--tls-cert-file cert-file", "--tls-key-file key-file", "[-T]",
 	"[-r]", "-i input-file", NULL,
-	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "-s host", "--tls-connect psk",
+	"[-v]", "-c config-file [-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]",
+	"--tls-connect cert", "--tls-ca-file CA-file", "[--tls-crl-file CRL-file]",
+	"[--tls-server-cert-issuer cert-issuer]", "[--tls-server-cert-subject cert-subject]",
+	"--tls-cert-file cert-file", "--tls-key-file key-file", "-k key", "-o value", NULL,
+	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]",
+	"--tls-connect cert", "--tls-ca-file CA-file", "[--tls-crl-file CRL-file]",
+	"[--tls-server-cert-issuer cert-issuer]", "[--tls-server-cert-subject cert-subject]",
+	"--tls-cert-file cert-file", "--tls-key-file key-file", "[-T]", "[-r]", "-i input-file", NULL,
+	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-u timeout]", "-s host", "--tls-connect psk",
 	"--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "-k key", "-o value", NULL,
-	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-s host]", "--tls-connect psk",
+	"[-v]", "-z server", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]", "--tls-connect psk",
 	"--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "[-T]", "[-r]", "-i input-file", NULL,
-	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "--tls-connect psk",
-	"--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "-k key", "-o value", NULL,
-	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "--tls-connect psk",
-	"--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "[-T]", "[-r]", "-i input-file", NULL,
+	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]",
+	"--tls-connect psk", "--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "-k key", "-o value", NULL,
+	"[-v]", "-c config-file", "[-z server]", "[-p port]", "[-I IP-address]", "[-s host]", "[-u timeout]",
+	"--tls-connect psk", "--tls-psk-identity PSK-identity", "--tls-psk-file PSK-file", "[-T]", "[-r]",
+	"-i input-file", NULL,
 #endif
 	"-h", NULL,
 	"-V", NULL,
@@ -120,6 +122,8 @@
 	"                             received. This can be used when reading from",
 	"                             standard input",
 	"",
+	"  -u --timeout seconds       Specify timeout in seconds (default: " GET_SENDER_TIMEOUT_STR ")",
+	"",
 	"  -v --verbose               Verbose mode, -vv for more details",
 	"",
 	"  -h --help                  Display this help message",
@@ -213,6 +217,7 @@
 	{"input-file",			1,	NULL,	'i'},
 	{"with-timestamps",		0,	NULL,	'T'},
 	{"real-time",			0,	NULL,	'r'},
+	{"timeout",			1,	NULL,	'u'},
 	{"verbose",			0,	NULL,	'v'},
 	{"help",			0,	NULL,	'h'},
 	{"version",			0,	NULL,	'V'},
@@ -229,7 +234,7 @@
 };
 
 /* short options */
-static char	shortopts[] = "c:I:z:p:s:k:o:Ti:rvhV";
+static char	shortopts[] = "c:I:z:p:s:k:o:Ti:ru:vhV";
 
 /* end of COMMAND LINE OPTIONS */
 
@@ -245,6 +250,7 @@
 static char		*ZABBIX_HOSTNAME = NULL;
 static char		*ZABBIX_KEY = NULL;
 static char		*ZABBIX_KEY_VALUE = NULL;
+static unsigned short	timeout = GET_SENDER_TIMEOUT;
 
 #if !defined(_WINDOWS)
 static void	send_signal_handler(int sig)
@@ -492,7 +498,7 @@
 	}
 
 	if (SUCCEED == (tcp_ret = zbx_tcp_connect(&sock, CONFIG_SOURCE_IP, sendval_args->server, sendval_args->port,
-			GET_SENDER_TIMEOUT, configured_tls_connect_mode, tls_arg1, tls_arg2)))
+			timeout, configured_tls_connect_mode, tls_arg1, tls_arg2)))
 	{
 		if (1 == sendval_args->sync_timestamp)
 		{
@@ -677,6 +683,9 @@
 			case 'r':
 				REAL_TIME = 1;
 				break;
+			case 'u':
+				timeout = (unsigned short)atoi(zbx_optarg);
+				break;
 			case 'v':
 				if (LOG_LEVEL_WARNING > CONFIG_LOG_LEVEL)
 					CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
