Author Topic: receiving a TCP_EVENT_ABORT event  (Read 25809 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
receiving a TCP_EVENT_ABORT event
« on: October 06, 2010, 05:55:19 AM »
Hi Mark,
  Within my application I call fnTCP_close(..) to close a socket. Straight away my windows application also closes the socket but after a couple of seconds the TCP_EVENT_ABORT gets called within my callback routine.

Why is this?

Does this mean I cannot make another connect command until I receive this?

Thanks
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3244
    • View Profile
    • uTasker
Re: receiving a TCP_EVENT_ABORT event
« Reply #1 on: October 06, 2010, 12:57:20 PM »
Hi Neil

When you close a connection it also needs the peer to acknowledge the close (the peer may still have data to send and may want to complete this first) and so it may not be immediate. I would look at the close phase using WireShark so that you see exactly what it is doing.

A reset means that the peer sent a TCP RST. Exactly why is possibly visible from the recording. It may be due to an error while closing but it may be something that the TCP stack on the PC does as standard.

If you only have one socket you need to wait for it's connection to close before starting a new connection. This will usually be informed by the TCP_EVENT_CLOSED event, but the TCP_EVENT_ABORT is handled equivalently [the TCP_EVENT_CLOSED is the textbook case, whereas the TCP_EVENT_ABORT is possibly more an error case].

Regards

Mark