CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Microchip TCP/IP stack problem for TCP

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
DaeHyun
Guest







Microchip TCP/IP stack problem for TCP
PostPosted: Fri Oct 27, 2006 4:06 am     Reply with quote

Hi, i'm using stack version 3.75 and CCSC.
IP/ARP/ICMP is working well.
For TCP, all data can be received well, but data can't be sent !!
after debugging, i found the source to make problem.

that is,

Code:

BOOL TCPIsPutReady(TCP_SOCKET s)
{
 if(TCB.RemoteWindow == 0) <<--- always true
return FALSE;
if ( TCB.TxBuffer == INVALID_BUFFER )
return IPIsTxReady(FALSE);
else
return TCB.Flags.bIsPutReady;
}



As you can see red words, IF statement is always true..
How can i solve this problem..?? Have any ideas ??


And the main procedure that i was coded is as follows,
--------------------------------------------------------------------------------
Code:

Int8 telnetdBuff[TELNETD_BUFF_LEN];
Int8 telnetdBuffHeadPtr = 0;
Int8 telnetdBuffTailPtr = 0;

SM_TELNETD smTelnetd = SM_TELNETD_IDLE;

void TELNETD_Init (void)
{
   telnetd_socket = TCPListen (TELNET_PORT);
}

void TELNETD_Task (void)
{
   BOOL bContinue = FALSE;
   
   if ( !TCPIsConnected(telnetd_socket) ) // [b]<<---- Check Connection [/b]
    {
       smTelnetd = SM_TELNETD_IDLE;
       return;
   }

   do {       
       switch (smTelnetd)
       {
       case SM_TELNETD_IDLE:
           smTelnetd = SM_TELNETD_MAIN;
   
       case SM_TELNETD_MAIN:
           TELNETD_Process ();             
           break;
 
       case SM_TELNETD_DISCONNECT:
           if(TCPIsPutReady (telnetd_socket))
           {
               TCPDisconnect (telnetd_socket);
               smTelnetd = SM_TELNETD_DISCONNECT_WAIT;
           }
           break;
       }   
       
   }
   while (bContinue);
}


void TELNETD_Process (void)
{
   Int8 length = 0;

   if (TCPIsGetReady(telnetd_socket))
   {
       while (length <TELNETD_BUFF_LEN>= TELNETD_BUFF_LEN)
           {
               telnetdBuffHeadPtr = 0;
           }
       }
       TCPDiscard(telnetd_socket);       
   }   
   
   /* echo */
   if(TCPIsPutReady (telnetd_socket)) // <<Always>= TELNETD_BUFF_LEN)
           {
               telnetdBuffTailPtr = 0;
           }
       }
       TCPFlush (telnetd_socket);
   }
}

--------------------------------------------------------------------------------
This is simple echo program with TCP. As above, all data sent from server has been received in the function
TELNETD_Process. But cannot send.

Is there any bugs? if the cause of this problem is window size, how can i solve ?


[/code]
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Oct 27, 2006 4:35 am     Reply with quote

It looks like something went wrong with the initial connection setup.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Fri Oct 27, 2006 10:39 am     Reply with quote

The remotes available window size is updated in each received packet. If the remote application is not processing fast enough the window should narrow and eventually close. The PIC should respect the remote window size and not try to overflow it with a transmitted packet. The window size is basically a flow control protocol it shouldn't remain at zero if the socket is open and functioning. Given processing resources the remote application should be consuming sent packets and opening the window.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group