So how would i set conditions in the for loop if i do not know the size of the file until the end of the loop? I figure thats why the server is making an extra read call. It is looping until the data is read, then looping one extra time resulting in the extra call to read.