Advertisement
Advertisement
| 02.01.2008 at 06:29PM PST, ID: 23131392 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: |
int readData(int openSocket, char *buf, int bufsize)
{
int bcount; //total num bytes read
int br; //bytes read in this pass
bcount= 0;
br= 0;
br = recv(openSocket, buf, bufsize-bcount,0);
bcount += br;
while (br > 0) //if 0 is returned it means the msg is complete?
{
if ((br= recv(openSocket,buf,bufsize-bcount, 0)) > 0) {
bcount += br;
buf += br;
}
else if (br < 0)
return(-1);
}
return(bcount);
}
|