Browse code

change write/read to send/recv on socket operations

Originally committed as revision 8069 to svn://svn.ffmpeg.org/ffmpeg/trunk

Alex Beregszaszi authored on 2007/02/22 21:38:37
Showing 1 changed files
... ...
@@ -787,7 +787,7 @@ static int handle_connection(HTTPContext *c)
787 787
             return 0;
788 788
         /* read the data */
789 789
     read_loop:
790
-        len = read(c->fd, c->buffer_ptr, 1);
790
+        len = recv(c->fd, c->buffer_ptr, 1, 0);
791 791
         if (len < 0) {
792 792
             if (errno != EAGAIN && errno != EINTR)
793 793
                 return -1;
... ...
@@ -822,7 +822,7 @@ static int handle_connection(HTTPContext *c)
822 822
         /* no need to write if no events */
823 823
         if (!(c->poll_entry->revents & POLLOUT))
824 824
             return 0;
825
-        len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr);
825
+        len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
826 826
         if (len < 0) {
827 827
             if (errno != EAGAIN && errno != EINTR) {
828 828
                 /* error : close connection */
... ...
@@ -889,7 +889,7 @@ static int handle_connection(HTTPContext *c)
889 889
         /* no need to write if no events */
890 890
         if (!(c->poll_entry->revents & POLLOUT))
891 891
             return 0;
892
-        len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr);
892
+        len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
893 893
         if (len < 0) {
894 894
             if (errno != EAGAIN && errno != EINTR) {
895 895
                 /* error : close connection */
... ...
@@ -914,8 +914,8 @@ static int handle_connection(HTTPContext *c)
914 914
         /* no need to write if no events */
915 915
         if (!(c->poll_entry->revents & POLLOUT))
916 916
             return 0;
917
-        len = write(c->fd, c->packet_buffer_ptr,
918
-                    c->packet_buffer_end - c->packet_buffer_ptr);
917
+        len = send(c->fd, c->packet_buffer_ptr,
918
+                    c->packet_buffer_end - c->packet_buffer_ptr, 0);
919 919
         if (len < 0) {
920 920
             if (errno != EAGAIN && errno != EINTR) {
921 921
                 /* error : close connection */
... ...
@@ -2286,8 +2286,8 @@ static int http_send_data(HTTPContext *c)
2286 2286
                     c->buffer_ptr += len;
2287 2287
 
2288 2288
                     /* send everything we can NOW */
2289
-                    len = write(rtsp_c->fd, rtsp_c->packet_buffer_ptr,
2290
-                                rtsp_c->packet_buffer_end - rtsp_c->packet_buffer_ptr);
2289
+                    len = send(rtsp_c->fd, rtsp_c->packet_buffer_ptr,
2290
+                                rtsp_c->packet_buffer_end - rtsp_c->packet_buffer_ptr, 0);
2291 2291
                     if (len > 0) {
2292 2292
                         rtsp_c->packet_buffer_ptr += len;
2293 2293
                     }
... ...
@@ -2311,7 +2311,7 @@ static int http_send_data(HTTPContext *c)
2311 2311
                 }
2312 2312
             } else {
2313 2313
                 /* TCP data output */
2314
-                len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr);
2314
+                len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
2315 2315
                 if (len < 0) {
2316 2316
                     if (errno != EAGAIN && errno != EINTR) {
2317 2317
                         /* error : close connection */
... ...
@@ -2368,7 +2368,7 @@ static int http_receive_data(HTTPContext *c)
2368 2368
     if (c->buffer_end > c->buffer_ptr) {
2369 2369
         int len;
2370 2370
 
2371
-        len = read(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr);
2371
+        len = recv(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
2372 2372
         if (len < 0) {
2373 2373
             if (errno != EAGAIN && errno != EINTR) {
2374 2374
                 /* error : close connection */