0

I have problem that I only get 16 bytes from my QTcpSocket where I obtained transmission Client-server. I would like to have ability to send more data at one time ( longer than 16 bytes).

I send data by (length is here about 33):

  if(socket->isWritable())
    {
        socket->write(frame,lenght);
        socket->waitForBytesWritten();
    }

And recieve:

socket->setReadBufferSize(5000);
QString message = socket->readAll();

Has anybody know why the length is limited?

Leo Chapiro
  • 13,678
  • 8
  • 61
  • 92
Krzysztof Bieda
  • 187
  • 1
  • 2
  • 10
  • 3
    TCP does not enforce any message framing boundaries, so the application has no control over how many bytes will be received together vs separately. The only thing you can do is have your receiver keep reading bytes, in a loop, until it has read "enough" bytes (for whatever definition of "enough" your app wants to use). – Jeremy Friesner Jun 29 '16 at 20:07
  • Possible duplicate of [How to read complete data in QTcpSocket?](http://stackoverflow.com/questions/20288282/how-to-read-complete-data-in-qtcpsocket) – thuga Jun 30 '16 at 13:53

0 Answers0