150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/*
** Initialize a blob to the data on an input socket. return
** the number of bytes read into the blob. Any prior content
** of the blob is discarded, not freed.
**
** The function was placed here in http.c due to it's socket
** nature and we did not want to introduce socket headers into
** the socket netural blob.c file.
*/
int socket_read_blob(Blob *pBlob, int pSockId, int nToRead){
int i=0,read=0;
char rbuf[50];
blob_zero(pBlob);
while ( i<nToRead ){
read = recv(pSockId, rbuf, 50, 0);
i += read;
if( read<0 ){
return 0;
}
blob_append(pBlob, rbuf, read);
}
return blob_size(pBlob);
}
#endif
|
|
|
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/*
** Initialize a blob to the data on an input socket. return
** the number of bytes read into the blob. Any prior content
** of the blob is discarded, not freed.
**
** The function was placed here in http.c due to it's socket
** nature and we did not want to introduce socket headers into
** the socket neutral blob.c file.
*/
int socket_read_blob(Blob *pBlob, int pSockId, int nToRead){
int i=0,read=0;
char rbuf[50];
blob_zero(pBlob);
while ( i<nToRead ){
read = recv(pSockId, rbuf, 50, 0);
i += read;
if( read<=0 ){
return 0;
}
blob_append(pBlob, rbuf, read);
}
return blob_size(pBlob);
}
#endif
|