µTasker Forum
September 09, 2010, 06:22:11 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: January 2010: uTasker utFAT version released for M522XX, SAM7X, LM3SXXXX, LPC2XXX and AVR32 - see utFAT board for full details!
Note that Internet Explorer 8 doesn't work with the forum (unless compatibility view is selected); please use Firefox or Chrome (or other well behaved browsers) as alternative!
 
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: TCP send problem  (Read 605 times)
kno
Newbie
*
Offline Offline

Posts: 1


View Profile
« on: May 27, 2010, 11:51:59 pm »


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");
}
}
Logged
mark
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1909



View Profile WWW
« Reply #1 on: May 28, 2010, 01:10:46 am »

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

Logged
seniorsrule
Newbie
*
Offline Offline

Posts: 1


View Profile WWW
« Reply #2 on: June 30, 2010, 11:42:00 am »

I've got a similar issue, found a white paper with some info **finding link**
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Copyright © 2010 utasker.com. Webdesign and Hosting by e-future.ch 2010
Valid XHTML 1.0! Valid CSS!
Page created in 0.071 seconds with 18 queries.