I am making a simple file transfer app based on Threaded Fortune Server. I am running into an issue where I am losing the last couple of bytes from my file.

Client Code:
Qt Code:
  1. file.open(QIODevice::ReadOnly);
  2. DataStream infile(&file);
  3. DataStream in(socket);
  4. int count = 0;
  5. char point[1500];
  6. while(!infile.atEnd())
  7. {
  8. count = infile.readRawData(point,1500);
  9. in.writeRawData(point,count);
  10. TCPSocket->waitForBytesWritten(300);
  11. }
To copy to clipboard, switch view to plain text mode 

Server Side:
This function is connected to readyRead
Qt Code:
  1. void ReadNow{
  2. QDataStream input(socket);
  3. QDataStream output(file);
  4. char point[1500];
  5. int count = 0;
  6. while(!input.atEnd())
  7. {
  8. count = input.readRawData(point,1500);
  9. totalbytes+=count;
  10. output.writeRawData(point,count);
  11. }
  12. file.waitForBytesWritten(1000);
  13. }
To copy to clipboard, switch view to plain text mode 

I am unsure of where the missing bytes are going.