Index: stream/tcp.c
===================================================================
--- stream/tcp.c	(revision 32444)
+++ stream/tcp.c	(working copy)
@@ -53,7 +53,32 @@
 
 /* IPv6 options */
 int   network_prefer_ipv4 = 0;
+int recv_timeout = -1;
+int send_timeout = -1;
 
+void
+setSockTimeout(int socket_server_fd, int timeout, int send_recv_option) {
+#if HAVE_WINSOCK2_H
+	int to;
+#else
+	struct timeval to;
+#endif
+
+	int cur_timeout = 10;
+	if(timeout > 0)
+		cur_timeout = timeout;
+
+#if HAVE_WINSOCK2_H
+	/* timeout in milliseconds */
+	to = cur_timeout * 1000;
+
+#else
+	to.tv_sec = cur_timeout;
+	to.tv_usec = 0;
+#endif
+	setsockopt(socket_server_fd, SOL_SOCKET, send_recv_option, &to, sizeof(to));
+}
+
 // Converts an address family constant to a string
 
 static const char *af2String(int af) {
@@ -94,9 +119,6 @@
 
 #if HAVE_WINSOCK2_H
 	unsigned long val;
-	int to;
-#else
-	struct timeval to;
 #endif
 
 #if HAVE_WINSOCK2_H && defined(HAVE_AF_INET6)
@@ -116,16 +138,12 @@
 	}
 
 #if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)
-#if HAVE_WINSOCK2_H
-	/* timeout in milliseconds */
-	to = 10 * 1000;
-#else
-	to.tv_sec = 10;
-	to.tv_usec = 0;
+	if(send_timeout != 0)
+		setSockTimeout(socket_server_fd, send_timeout, SO_RCVTIMEO);
+
+	if(recv_timeout != 0)
+		setSockTimeout(socket_server_fd, recv_timeout, SO_RCVTIMEO);
 #endif
-	setsockopt(socket_server_fd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to));
-	setsockopt(socket_server_fd, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof(to));
-#endif
 
 	switch (af) {
 		case AF_INET:  our_s_addr = (void *) &server_address.four.sin_addr; break;
Index: stream/tcp.h
===================================================================
--- stream/tcp.h	(revision 32444)
+++ stream/tcp.h	(working copy)
@@ -26,6 +26,8 @@
 #define MPLAYER_TCP_H
 
 extern int network_prefer_ipv4;
+extern int send_timeout;
+extern int recv_timeout;
 
 /* Connect to a server using a TCP connection */
 int connect2Server (char *host, int port, int verb);
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revision 32444)
+++ DOCS/man/en/mplayer.1	(working copy)
@@ -1224,7 +1224,17 @@
 .B \-udp\-slave
 Listen on \-udp\-port and match the master's position.
 .
+.TP
+.B \-send\-timeout <sec>
+Sets send timeout on tcp socket (default: 10). 
+No timeout is set if sec = 0.
 .
+.TP
+.B \-recv\-timeout <sec>
+Sets recv timeout on tcp socket (default: 10). 
+No timeout is set if sec = 0.
+.
+.
 .SH "DEMUXER/STREAM OPTIONS"
 .
 .TP
Index: cfg-mplayer.h
===================================================================
--- cfg-mplayer.h	(revision 32444)
+++ cfg-mplayer.h	(working copy)
@@ -277,6 +277,8 @@
     {"udp-ip", &udp_ip, CONF_TYPE_STRING, 0, 0, 1, NULL},
     {"udp-port", &udp_port, CONF_TYPE_INT, 0, 1, 65535, NULL},
     {"udp-seek-threshold", &udp_seek_threshold, CONF_TYPE_FLOAT, CONF_RANGE, 0.1, 100, NULL},
+    {"send-timeout", &send_timeout, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL},
+    {"recv-timeout", &recv_timeout, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL},
 #endif /* CONFIG_NETWORKING */
 
     // dump some stream out instead of playing the file
