Revision 9ddd71fc libav/tcp.c

View differences:

libav/tcp.c
22 22
#include <sys/types.h>
23 23
#include <sys/socket.h>
24 24
#include <netinet/in.h>
25
#include <arpa/inet.h>
25
#ifndef __BEOS__
26
# include <arpa/inet.h>
27
#else
28
# include "barpainet.h"
29
#endif
26 30
#include <netdb.h>
27 31

  
28 32
typedef struct TCPContext {
......
103 107

  
104 108
    size1 = size;
105 109
    while (size > 0) {
110
#ifdef CONFIG_BEOS_NETSERVER
111
        len = recv (s->fd, buf, size, 0);
112
#else
106 113
        len = read (s->fd, buf, size);
114
#endif
107 115
        if (len < 0) {
108 116
            if (errno != EINTR && errno != EAGAIN)
117
#ifdef __BEOS__
118
                return errno;
119
#else
109 120
                return -errno;
121
#endif
110 122
            else
111 123
                continue;
112 124
        } else if (len == 0) {
......
125 137

  
126 138
    size1 = size;
127 139
    while (size > 0) {
140
#ifdef CONFIG_BEOS_NETSERVER
141
        ret = send (s->fd, buf, size, 0);
142
#else
128 143
        ret = write (s->fd, buf, size);
144
#endif
129 145
        if (ret < 0 && errno != EINTR && errno != EAGAIN)
146
#ifdef __BEOS__
147
            return errno;
148
#else
130 149
            return -errno;
150
#endif
131 151
        size -= ret;
132 152
        buf += ret;
133 153
    }
......
137 157
static int tcp_close(URLContext *h)
138 158
{
139 159
    TCPContext *s = h->priv_data;
160
#ifdef CONFIG_BEOS_NETSERVER
161
    closesocket(s->fd);
162
#else
140 163
    close(s->fd);
164
#endif
141 165
    av_free(s);
142 166
    return 0;
143 167
}

Also available in: Unified diff