[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.100,1.101
Sascha Sommer CVS
syncmail at mplayerhq.hu
Fri Jun 18 16:31:13 CEST 2004
CVS change done by Sascha Sommer CVS
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv7898/libmpdemux
Modified Files:
network.c
Log Message:
calling bind with multicast addresses doesn't work on windows, patch by Martin Decky <deckm1am at ss1000.ms.mff.cuni.cz>
Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- network.c 14 May 2004 23:10:43 -0000 1.100
+++ network.c 18 Jun 2004 14:31:10 -0000 1.101
@@ -1080,6 +1080,7 @@
struct sockaddr_in server_address;
struct ip_mreq mcast;
struct timeval tv;
+ struct hostent *hp;
mp_msg(MSGT_NETWORK,MSGL_V,"Listening for traffic on %s:%d ...\n", url->hostname, url->port );
@@ -1091,12 +1092,16 @@
}
if( isalpha(url->hostname[0]) ) {
- struct hostent *hp =(struct hostent*)gethostbyname( url->hostname );
+#ifndef HAVE_WINSOCK2
+ hp =(struct hostent*)gethostbyname( url->hostname );
if( hp==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Counldn't resolve name: %s\n", url->hostname);
return -1;
}
memcpy( (void*)&server_address.sin_addr.s_addr, (void*)hp->h_addr, hp->h_length );
+#else
+ server_address.sin_addr.s_addr = htonl(INADDR_ANY);
+#endif
} else {
#ifndef HAVE_WINSOCK2
#ifdef USE_ATON
@@ -1105,8 +1110,7 @@
inet_pton(AF_INET, url->hostname, &server_address.sin_addr);
#endif
#else
- unsigned int addr = inet_addr(url->hostname);
- memcpy( (void*)&server_address.sin_addr, (void*)&addr, sizeof(addr) );
+ server_address.sin_addr.s_addr = htonl(INADDR_ANY);
#endif
}
server_address.sin_family=AF_INET;
@@ -1123,6 +1127,20 @@
return -1;
}
}
+
+#ifdef HAVE_WINSOCK2
+ if (isalpha(url->hostname[0])) {
+ hp =(struct hostent*)gethostbyname( url->hostname );
+ if( hp==NULL ) {
+ mp_msg(MSGT_NETWORK,MSGL_ERR,"Counldn't resolve name: %s\n", url->hostname);
+ return -1;
+ }
+ memcpy( (void*)&server_address.sin_addr.s_addr, (void*)hp->h_addr, hp->h_length );
+ } else {
+ unsigned int addr = inet_addr(url->hostname);
+ memcpy( (void*)&server_address.sin_addr, (void*)&addr, sizeof(addr) );
+ }
+#endif
// Increase the socket rx buffer size to maximum -- this is UDP
rxsockbufsz = 240 * 1024;
More information about the MPlayer-cvslog
mailing list