[MPlayer-cvslog] r22397 - trunk/stream/tcp.c
ivo
subversion at mplayerhq.hu
Thu Mar 1 15:57:44 CET 2007
Author: ivo
Date: Thu Mar 1 15:57:44 2007
New Revision: 22397
Modified:
trunk/stream/tcp.c
Log:
winsocks expects an int in milliseconds instead of struct timeval to set
the timeout of a socket
patch by Zuxy Meng, zuxy dot meng ... gmailcom
Modified: trunk/stream/tcp.c
==============================================================================
--- trunk/stream/tcp.c (original)
+++ trunk/stream/tcp.c Thu Mar 1 15:57:44 2007
@@ -77,6 +77,9 @@ connect2Server_with_af(char *host, int p
#ifdef HAVE_WINSOCK2
u_long val;
+ int to;
+#else
+ struct timeval to;
#endif
socket_server_fd = socket(af, SOCK_STREAM, 0);
@@ -88,10 +91,15 @@ connect2Server_with_af(char *host, int p
}
#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));
+#ifdef HAVE_WINSOCK2
+ /* timeout in milliseconds */
+ to = 10 * 1000;
+#else
+ to.tv_sec = 10;
+ to.tv_usec = 0;
+#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) {
More information about the MPlayer-cvslog
mailing list