This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3135MOD: Receiving Large data from socket

Part Number: CC3135MOD

We are trying to send a chunk of data of size 4096 via tcp socket to the simple link device, on the receiver side it is observed this is received in two receive calls, the first one is of 1460 length and the remaining bytes in second call, data is incorrectly received in 2nd packet, if we receive data in 1024 byte packets, it works fine. the receiving code is as follows:

totalbytes = 0u;
status = 0;
len = 4096;
char msg[4096];
do {
status = sl_Recv(socketID,&msg[totalbytes],len-totalbytes,0);
totalbytes += status;
}while((status >=0 ) && (totalbytes < len));
if(status < 0)
{
Error_handler();
}

What is the correct way of receiving large number of bytes?