# sock\_close(): Time to fully close socket?

**URL:** <https://forums.digi.com/t/sock-close-time-to-fully-close-socket/17759>\
**Category:** Rabbit Software\
**Tags:** tcp-sockets, tcp, dynamic-c, sock\_close\
**Created:** [December 1, 2016, 9:33am UTC](https://forums.digi.com/t/sock-close-time-to-fully-close-socket/17759 "2016-12-01T09:33:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casey](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@casey](https://forums.digi.com/u/casey)\
**Post date:** [December 1, 2016, 9:33am UTC](https://forums.digi.com/t/sock-close-time-to-fully-close-socket/17759/1 "2016-12-01T09:33:54Z")

</div>

I’m using an RCM6600W with code which calls tcp\_tick() just about once every 80ms.

If I establish a connection, receive a small amount of data, wait 15 seconds, and then call sock\_close, I’ve found that waiting up to 30 seconds does not provide enough time to actually fully close the socket (ie sock\_alive() still says the socket is alive after 30 seconds).

When sock\_close is called, it looks like the rabbit sends out FIN/ACK when I’d think it should just be sending out FIN, and then waiting for a FIN/ACK from the server before finally accepting an ACK which closes the connection (if wikipedia is to be believed).

Not sure if there are proper deviations from the process, but I think things are breaking down as Windows never sends a FIN or a FIN/ACK in response to the rabbit’s FIN/ACK. I’m taking a look at how sock\_close works behind the scenes right now and seeing if I can modify it to just send a FIN on close.

At that point hopefully everything will fall into place.

---

<div class="post-metadata">

**Author:** ![cpigilam](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@cpigilam](https://forums.digi.com/u/cpigilam)\
**Post date:** [January 5, 2017, 2:58am UTC](https://forums.digi.com/t/sock-close-time-to-fully-close-socket/17759/2 "2017-01-05T02:58:54Z")

</div>

You may use sock\_abort() to close a connection immediately.
