Author Topic: TCP_EVENT_REGENERATE  (Read 8018 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
TCP_EVENT_REGENERATE
« 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


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: TCP_EVENT_REGENERATE
« Reply #1 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