This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data lose while sending through TCP/IP

Hi to all, I am working on RL-ARM RL-TCPnet. I make my lpc2388 as TCP active open and sending 16 bytes hex value to my PC for 40 times(627 bytes string). For testing i am trying with 32 bytes string. I am encrypting them and sending it to pc.

For the first 16 bytes it transmits the data perfectly and received ACK from PC.

in the send_data function

  switch(tcp_get_state(tcp_soc))
  {
        case TCP_STATE_FREE:
        case TCP_STATE_CLOSED :
                tcp_connect(tcp_soc, remote_ip, 1001, 0);
                break;

        case TCP_STATE_CONNECT:

//              if(wait_ack == __TRUE)
                        if(tcp_check_send(tcp_soc))
                        {
                                sendbuf = tcp_get_buf (17);
                                memcpy (sendbuf, out, 16);
                                tcp_send(tcp_soc, sendbuf, 16);
                                printf("\r\n Host to client:%d\n", v++);
                                for(i = 0; i<16; i++)
                                {
//                                      printf("\r\n Sending encrypted values are %x", sendbuf[i]);
                                        printf("%x", out[i]);
                                }
                                return;
                        }
 }

after sending it, i am checking the acknowledgment using callback function and receive the same data what i sent, using callback() case TCP_EVT_DATA.

                 case TCP_EVT_DATA :
                                printf("\r\n Size of the data received is %d\n", par);
                                for(i =0; i <par; i++)
                                {
                                        out[i] = *ptr++;
                                        printf("%x", out[i]);
                                }
                                break;

result

. Size of data is 32.Connection Abort..Connection Abort..Event Connect.
. Key pressed
. SendCountvalue is 1
. Host to client:0.98f8dbf72868eaa6e8e9e2a6a64922e7.Event ACK 0.
. Size of the data received is 1.98
. SendCountvalue is 2
. Host to client:1.d2f84ee5984fe3428a83949df2e3a9
. Size of the data received is 15.f8dbf72868eaa6e8e9e2a6a64922e7.Event ACK 1.
. Size of the data received is 17.da2f84ee5984fe3428a83949df2e3a9

In the result i have sent a 16 byte value but when receiving the same data at first time, i was able to get only one byte and after that remaining 15 bytes.
You can see that in my result. So you can come to know whats the problem i am facing.

Can anybody help me where is the problem that either in TCP configuration or somewhere else?

I havent changed anything from default configuration. So Do i have to give those value here for your reference?

scope of this work is that i want to send some encrypted data to PC and receive it and send it back to MCU through same hyper terminal for decrypting the data and after done this, show it to all that the encryption and decryption done by us well :).