I have a somewhat strange problem, which may not really be a qt problem, but might have more to do with my my understanding of tcp

However, I have not seen it when programming sockets using the standard socket API under Linux

I have a linux application that launches a TCP server. It waits for a data request message, and when it gets it, sends

1) a data start message, containing the number of bytes to be transferred
2) a series of lines of ascii text, totalling the number of bytes described in the initial message.

my QT application (running on windows XP, QT version 4.6) always receives the data request message--but does not get all of the line by line data. here's my receiving code:
Qt Code:
  1. int totalBytesRead = 0;
  2. int byteCount;
  3. bytesToRead = totalBytesToRead;
  4. massiveArray = (char *)malloc(bytesToRead * sizeof(char));
  5.  
  6.  
  7. // here is where I neeed to open a temporary file and write this data out
  8. tempIniFile = new QTemporaryFile;
  9. if(tempIniFile->open()){
  10. char *theTempFile = strdup((char *)tempIniFile->fileName().toAscii().data());
  11.  
  12.  
  13. while(totalBytesRead < totalBytesToRead){
  14. byteCount = iniClient->readLine(massiveArray,bytesToRead);
  15.  
  16. tempIniFile->write(massiveArray,byteCount);
  17. totalBytesRead += byteCount;
  18. bytesToRead -= byteCount;
  19. }
To copy to clipboard, switch view to plain text mode 
byteCount will eventually stop being anything but 0--sometimes after 10 lines of data, sometimes after 200, but once it returns zero, I never get anything else from the socket.

My understanding is that if the reading TCP buffers are full, the sender will block unitl it can write again--I get no errors there, it always shows a successful number of bytes written. Unless I misunderstand, this means they are successfully transferred to the client--but my software isn't getting the data.

Do I need to implement some handshaking after each line?

Any other ideas?

Thanks in advance

Jonathan Howland