in nailgun-client/c/ng.c [349:360]
unsigned long recvToBuffer(unsigned long len) {
unsigned long bytesRead = 0;
while(bytesRead < len) {
int thisPass = recv(nailgunsocket, buf + bytesRead, len - bytesRead, MSG_WAITALL);
if (thisPass == 0 || thisPass == -1) {
perror("recv");
handleSocketClose();
}
bytesRead += thisPass;
}
return bytesRead;
}