Mercurial > mplayer.hg
comparison libmpdemux/network.c @ 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 | 0c72c1d0d6a4 |
children | 54bcbf28698a |
comparison
equal
deleted
inserted
replaced
10205:a8aad67823db | 10206:35e306346e59 |
---|---|
426 if( fd<0 ) { | 426 if( fd<0 ) { |
427 return -1; | 427 return -1; |
428 } | 428 } |
429 mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request: [%s]\n", http_hdr->buffer ); | 429 mp_msg(MSGT_NETWORK,MSGL_DBG2,"Request: [%s]\n", http_hdr->buffer ); |
430 | 430 |
431 ret = write( fd, http_hdr->buffer, http_hdr->buffer_size ); | 431 ret = send( fd, http_hdr->buffer, http_hdr->buffer_size, 0 ); |
432 if( ret!=(int)http_hdr->buffer_size ) { | 432 if( ret!=(int)http_hdr->buffer_size ) { |
433 mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: didn't sent all the request\n"); | 433 mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: didn't sent all the request\n"); |
434 return -1; | 434 return -1; |
435 } | 435 } |
436 | 436 |
449 if( http_hdr==NULL ) { | 449 if( http_hdr==NULL ) { |
450 return NULL; | 450 return NULL; |
451 } | 451 } |
452 | 452 |
453 do { | 453 do { |
454 i = read( fd, response, BUFFER_SIZE ); | 454 i = recv( fd, response, BUFFER_SIZE, 0 ); |
455 if( i<0 ) { | 455 if( i<0 ) { |
456 mp_msg(MSGT_NETWORK,MSGL_ERR,"Read failed\n"); | 456 mp_msg(MSGT_NETWORK,MSGL_ERR,"Read failed\n"); |
457 http_free( http_hdr ); | 457 http_free( http_hdr ); |
458 return NULL; | 458 return NULL; |
459 } | 459 } |
792 //printf("read %d bytes from buffer\n", len ); | 792 //printf("read %d bytes from buffer\n", len ); |
793 } | 793 } |
794 | 794 |
795 if( len<size ) { | 795 if( len<size ) { |
796 int ret; | 796 int ret; |
797 ret = read( fd, buffer+len, size-len ); | 797 ret = recv( fd, buffer+len, size-len, 0 ); |
798 if( ret<0 ) { | 798 if( ret<0 ) { |
799 mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno)); | 799 mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno)); |
800 } | 800 } |
801 len += ret; | 801 len += ret; |
802 //printf("read %d bytes from network\n", len ); | 802 //printf("read %d bytes from network\n", len ); |