I am sending a QByteArray from server to client. the client needs to extract the first four bytes for length of packet and then read the rest of the packet. The unexpected value I get from length of packet though, is a very large value;
what I do is:
Qt Code:
  1. int len;
  2. char *data;
  3.  
  4. client.read((char*)len, 4); // read the first integer for the length
  5. client.read(data, len);
To copy to clipboard, switch view to plain text mode 

can anyone guess what the problem is?