µTasker Forum

µTasker Forum => µTasker general => Topic started by: neil on May 31, 2009, 08:06:48 AM

Title: TCP_EVENT_REGENERATE
Post by: neil on May 31, 2009, 08:06:48 AM
Hi Mark,
  On my tcp connection there are occasions when the TCP_EVENT_ACK is never called. In this case will a TCP_EVENT_REGENERATE be called instead, indicating lost frame? If so, do I simply resend the the packet like so:

int fnToServerTCP(USOCKET Socket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen)
{
   TCP_MESSAGE message;
   unsigned char Value;
   int Loop;
   
    switch (ucEvent) {

    case TCP_EVENT_REGENERATE:
                if(!uMemcpy((CHAR*)&message.ucTCP_Message,&ucIp_Data[0], usPortLen))
                                 if (fnSendTCP(Socket, (unsigned char *)&message.tTCP_Header, usPortLen, TCP_FLAG_PUSH) > 0)
                                   return APP_SENT_DATA;
                break;
   ..


Regards
Neil

Title: Re: TCP_EVENT_REGENERATE
Post by: mark on May 31, 2009, 12:09:50 PM
Hi Neil

If the TCP_EVENT_ACK is not called it seems as though either some frames are being lost or the acks are being lost. This should normally only happen quite rarely (especially if not a long connection over the Internet).

In this case the ACK monitor timer will fire and call the TCP_EVENT_REGENERATE. If using a simple socket (not buffered) the call back must regenerate the lost frame. Exactly how this is achieved depends on the application function of the TCP connection but your method looks correct.

Regards

Mark