µTasker Forum > FreescaleTM MC9S12NE64

TCP send problem

(1/1)

kno:

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 OpenTCP example files.
 
 
void tcp_send_buffer(void)
{
UINT32 len;
while(tcp_checksend(tcp_soch) < 0);     
for(len=0;
    {
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");
}
}

mark:
Hi

I would check this thread for full details of using TCP: http://www.utasker.com/forum/index.php?topic=25.0

There are two methods - simple TCP sockets and buffered TCP sockets. When using simple TCP socket it is important to wait for an ACK before sending a second frame, otherwise there will be sequence number errors. Buffered TCP handles this but needs more memory (critical on NE64!)

Regards

Mark

Navigation

[0] Message Index

Go to full version