Keun-Sik No

tcp_send only works once, fails to second time.

Discussion created by Keun-Sik No on May 19, 2010
Latest reply on May 28, 2010 by John Dowdell
void cmd_run(void){
         send_nack("first\n");
         tcp_send_buffer;
         send_nack("EXIT\n");
         tcp_send_buffer;
         }

 

Hi

 

Here is my problem. I can send a tcp data once at each command like this,

 

void cmd_run(void){        

send_nack("first\n");        

tcp_send_buffer;      }  

 

void cmd_run1(void){

send_nack("EXIT\n");

tcp_send_buffer;        }

 

Both run and run1 are working fine, however if I try like this

 

 

void cmd_run(void){

         send_nack("first\n");

         tcp_send_buffer;

         send_nack("EXIT\n");

         tcp_send_buffer;

         }

 

 

It's not working. It freezes after display "first". You guys have any idea? Thanks in advance.

 

Here is a tcp_send_buffer. It's from the example files.

 

 

void tcp_send_buffer(void)

{

UINT32 len;

while(tcp_checksend(tcp_soch) < 0);     

for(len=0;:smileywink:

    {

net_buf[TCP_APP_OFFSET+len] = udp_tcp_buf[len];

if(udp_tcp_buf[len++] == '\n')

   break;

}

 

if(tcp_send(tcp_soch, &net_buf[TCP_APP_OFFSET], NETWORK_TX_BUFFER_SIZE - TCP_APP_OFFSET, len) == len)

   {

DEBUGOUT("TCP: bytes reply sent!\r\n");

}

else

{

    DEBUGOUT("TCP: error occured while trying to send data!\r\n");

}

}

Outcomes