它使用阻塞模式,并在循环下接收数据:
int nTotal = 0, nRead = 0, nLeft = 0, nBytes = 0;
..............
while(!done){
    nTotal = 0;
    nLeft = NUM_BYTES_REQUIRED; //要求读取的数据长度
    while(NUM_BYTES_REQUIRED){
        ....................
        nRead = recv(sock, &(buf[4096 - nBytes]),  //这是写错了,应该是buf[nBytes]
        nLeft,0);
        ....................
        nTotal += nRead;
        nLeft -= nRead;
        nBytes += nRead;
    }
}