Author Topic: Relationship between TCP_EVENT_REGENERATE, APP_ACCEPT and APP_SENT_DATA  (Read 3494 times)

Offline thamanjd

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
What's the relationship between TCP_EVENT_REGENERATE events with tcp listener and the return values APP_ACCEPT and APP_SENT_DATA?

On TCP_EVENT_REGENERATE I was setting a flag for myself, return APP_ACCEPT and resending outside of the listener but this does not appear to be the correct method (Ethereal shows a lot of RST,PREVIOUS SEGMENT LOST,DUP ACK packets going back and forward).

but if i set a flag for myself, return APP_SENT_DATA (even though i havn't sent anything yet) and then the resend it when my flag gets checked by another routine a short time later, Ethereal just shows the retransmission packet and then the "duplicate" ack.

it also works ok if i dont use my flag, resend inside the listener and then return APP_SENT_DATA.

Is TCP_FLAG_PUSH flag by itself correct for fnSendTCP in the case of retransmission?

John Dowdell




Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3068
    • View Profile
    • uTasker
Hi John

When you handle the TCP_EVENT_REGENERATE it is normal to return APP_SENT_DATA because the event means that a previous TCP frame was not ACKed and so generally a repetition is required immediately.
If APP_ACCEPT is returned (which is not normal) TCP will close the connection (the RST you see) because it believes that the application no longer wants to take part in the connection (i.e. it specifically expects the application to actively repeat).

There is in fact no provision for delaying the repeated data when a repetition is required. In the case of normal transmission, the option SUPPORT_DELAY_WEB_SERVING (specifically for HTTP - for example) allows the listener to return APP_ACCEPT and then later send more date, however in this case it would only be relevant for initial frames and not repeated frames.

The PUSH flag also has to be set appropriately. Generally this is not a problem because the regeneration generally can do the same thing as it did when it originally generated the frame and so also knows whether it wants to set the PUSH flag or not.

Regards

Mark

Offline thamanjd

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
thanks,
i guessed that would be the case. No problems.

John Dowdell