changeset 10206:35e306346e59

Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8@yahoo.de>
author alex
date Thu, 29 May 2003 19:36:58 +0000
parents a8aad67823db
children 35929ee89ef4
files libmpdemux/asf_mmst_streaming.c libmpdemux/asf_streaming.c libmpdemux/netstream.h libmpdemux/network.c libmpdemux/pnm.c libmpdemux/realrtsp/rmff.c libmpdemux/realrtsp/rtsp.c libvo/vo_bl.c
diffstat 8 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/asf_mmst_streaming.c	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/asf_mmst_streaming.c	Thu May 29 19:36:58 2003 +0000
@@ -90,7 +90,7 @@
 
   memcpy (&cmd.buf[48], data, length);
 
-  if (write (s, cmd.buf, length+48) != (length+48)) {
+  if (send (s, cmd.buf, length+48, 0) != (length+48)) {
     printf ("write error\n");
   }
 }
@@ -118,7 +118,7 @@
   while (command == 0x1b) {
     int len;
 
-    len = read (s, data, BUF_SIZE) ;
+    len = recv (s, data, BUF_SIZE, 0) ;
     if (!len) {
       printf ("\nalert! eof\n");
       return;
@@ -138,7 +138,7 @@
 
   while (total < count) {
 
-    len = read (s, &buf[total], count-total);
+    len = recv (s, &buf[total], count-total, 0);
 
     if (len<0) {
       perror ("read error:");
@@ -460,7 +460,7 @@
 // send_command(s, commandno ....)
   send_command (s, 1, 0, 0x0004000b, strlen(str) * 2+8, data);
 
-  len = read (s, data, BUF_SIZE) ;
+  len = recv (s, data, BUF_SIZE, 0) ;
 
   /*This sends details of the local machine IP address to a Funnel system at the server. 
   * Also, the TCP or UDP transport selection is sent.
@@ -475,7 +475,7 @@
   memset (data, 0, 8);
   send_command (s, 2, 0, 0, 28*2+8, data);
 
-  len = read (s, data, BUF_SIZE) ;
+  len = recv (s, data, BUF_SIZE, 0) ;
 
   /* This command sends file path (at server) and file name request to the server.
   * 0x5 */
--- a/libmpdemux/asf_streaming.c	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/asf_streaming.c	Thu May 29 19:36:58 2003 +0000
@@ -656,7 +656,7 @@
 		http_hdr = asf_http_request( stream->streaming_ctrl );
 		mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request [%s]\n", http_hdr->buffer );
 		for(i=0; i < (int)http_hdr->buffer_size ; ) {
-			int r = write( fd, http_hdr->buffer+i, http_hdr->buffer_size-i );
+			int r = send( fd, http_hdr->buffer+i, http_hdr->buffer_size-i, 0 );
 			if(r <0) {
 				mp_msg(MSGT_NETWORK,MSGL_ERR,"Socket write error : %s\n",strerror(errno));
 				return -1;
@@ -666,7 +666,7 @@
 		http_free( http_hdr );
 		http_hdr = http_new_header();
 		do {
-			i = read( fd, buffer, BUFFER_SIZE );
+			i = recv( fd, buffer, BUFFER_SIZE, 0 );
 //printf("read: %d\n", i );
 			if( i<=0 ) {
 				perror("read");
--- a/libmpdemux/netstream.h	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/netstream.h	Thu May 29 19:36:58 2003 +0000
@@ -45,7 +45,7 @@
 static int net_read(int fd, char* buf, int len) {
   int r = 0;
   while(len) {
-    r = read(fd,buf,len);
+    r = recv(fd,buf,len,0);
     if(r <= 0) {
       if(errno == EINTR) continue;
       if(r < 0)
@@ -95,7 +95,7 @@
 static int net_write(int fd, char* buf, int len) {
   int w;
   while(len) {
-    w = write(fd,buf,len);
+    w = send(fd,buf,len,0);
     if(w <= 0) {
       if(errno == EINTR) continue;
       if(w < 0)
--- a/libmpdemux/network.c	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/network.c	Thu May 29 19:36:58 2003 +0000
@@ -428,7 +428,7 @@
 	}
 	mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request: [%s]\n", http_hdr->buffer );
 	
-	ret = write( fd, http_hdr->buffer, http_hdr->buffer_size );
+	ret = send( fd, http_hdr->buffer, http_hdr->buffer_size, 0 );
 	if( ret!=(int)http_hdr->buffer_size ) {
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: didn't sent all the request\n");
 		return -1;
@@ -451,7 +451,7 @@
 	}
 
 	do {
-		i = read( fd, response, BUFFER_SIZE ); 
+		i = recv( fd, response, BUFFER_SIZE, 0 ); 
 		if( i<0 ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"Read failed\n");
 			http_free( http_hdr );
@@ -794,7 +794,7 @@
 
 	if( len<size ) {
 		int ret;
-		ret = read( fd, buffer+len, size-len );
+		ret = recv( fd, buffer+len, size-len, 0 );
 		if( ret<0 ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno));
 		}
--- a/libmpdemux/pnm.c	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/pnm.c	Thu May 29 19:36:58 2003 +0000
@@ -202,7 +202,7 @@
   while (total < len){ 
     int n;
 
-    n = write (s, &buf[total], len - total);
+    n = send (s, &buf[total], len - total, 0);
 
     if (n > 0)
       total += n;
@@ -238,7 +238,7 @@
       return -1;
     }
     
-    ret=read (fd, ((uint8_t*)buf)+total, count-total);
+    ret=recv (fd, ((uint8_t*)buf)+total, count-total, 0);
 
     if (ret<=0) {
       printf ("input_pnm: read error.\n");
--- a/libmpdemux/realrtsp/rmff.c	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/realrtsp/rmff.c	Thu May 29 19:36:58 2003 +0000
@@ -502,7 +502,7 @@
 
   do {
     buf = xbuffer_ensure_size(buf, index+8);
-    read(fd, buf+index, 8);
+    recv(fd, buf+index, 8, 0);
     chunk_type=BE_32(buf+index); index+=4;
     chunk_size=BE_32(buf+index); index+=4;
 
@@ -514,7 +514,7 @@
       case RMF_TAG:
       case PROP_TAG:
         buf = xbuffer_ensure_size(buf, index+chunk_size-8);
-        read(fd, buf+index, (chunk_size-8));
+        recv(fd, buf+index, (chunk_size-8), 0);
 	index+=(chunk_size-8);
         break;
       default:
--- a/libmpdemux/realrtsp/rtsp.c	Thu May 29 17:22:13 2003 +0000
+++ b/libmpdemux/realrtsp/rtsp.c	Thu May 29 19:36:58 2003 +0000
@@ -158,7 +158,7 @@
   while (total < len){ 
     int n;
 
-    n = write (s, &buf[total], len - total);
+    n = send (s, &buf[total], len - total, 0);
 
     if (n > 0)
       total += n;
@@ -181,7 +181,7 @@
 
   while (total < count) {
   
-    ret=read (fd, ((uint8_t*)buf)+total, count-total);
+    ret=recv (fd, ((uint8_t*)buf)+total, count-total, 0);
 
     if (ret<0) {
       if(errno == EAGAIN) {
--- a/libvo/vo_bl.c	Thu May 29 17:22:13 2003 +0000
+++ b/libvo/vo_bl.c	Thu May 29 19:36:58 2003 +0000
@@ -175,7 +175,7 @@
 }
 
 static void udp_send(bl_host_t *h) {
-	if (write(h->fd, bl_packet, bl_size) != bl_size) 
+	if (send(h->fd, bl_packet, bl_size, 0) != bl_size) 
 		mp_msg(MSGT_VO, MSGL_ERR, "unable to send to %s\n", h->name);
 }