# How to know whether TCP connection is alive

**URL:** <https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088>\
**Category:** Legacy HL Series\
**Created:** [October 9, 2018, 9:28am UTC](https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088 "2018-10-09T09:28:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fyusuke](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/fyusuke/32/3677_2.png) [@fyusuke](https://forum.sierrawireless.com/u/fyusuke)\
**Post date:** [October 9, 2018, 9:28am UTC](https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088/1 "2018-10-09T09:28:18Z")

</div>

Do anyone know AT Command which tells us whether TCP connection is broken or alivICPOe?

---

<div class="post-metadata">

**Author:** ![mlw](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/mlw/32/3706_2.png) [@mlw](https://forum.sierrawireless.com/u/mlw)\
**Post date:** [October 9, 2018, 10:05am UTC](https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088/2 "2018-10-09T10:05:18Z")

</div>

Hi,

The only way to do this is to try to send data, if it fails then the pipe is broken. There is no notification from the network if it break on their side for whatever reason i.e. not used so IP address is re assigned, etc.

Regards

Matt

---

<div class="post-metadata">

**Author:** ![fyusuke](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/fyusuke/32/3677_2.png) [@fyusuke](https://forum.sierrawireless.com/u/fyusuke)\
**Post date:** [October 9, 2018, 2:54pm UTC](https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088/3 "2018-10-09T14:54:46Z")

</div>

mlw, Thank you for reply!

What about “AT+KTCPSTAT=1”?  
Is this possible to get the TCP status ?  
I read it on AT command document.

According to the AT command document, this AT command can get TCP Socket Status.

---

<div class="post-metadata">

**Author:** ![mlw](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/mlw/32/3706_2.png) [@mlw](https://forum.sierrawireless.com/u/mlw)\
**Post date:** [October 9, 2018, 4:12pm UTC](https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088/4 "2018-10-09T16:12:03Z")

</div>

@fyusuke,

So that is the status from the module side and it will tell you if the unit thinks it has a socket open but if the link has gone down beyond the radio side then the unit is not notified of this i.e. if you leave a socket open, don’t send any data and the network reallocates your IP address, the unit will not be given any indication of this and it is only going to be detectable on a TCP level where you do not get any ACK’s back to the packets, at which point the unit will indicate the link has gone down after the TTL of the packet expires (I think it is set to 64), which is a long time.

This is one of the prices you pay for packet switching, when you are running over ultra reliable fibre links it is a given that the link is permanently up but not for links with a radio link or restricted resources.

Regards

Matt

---

<div class="post-metadata">

**Author:** ![fyusuke](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/fyusuke/32/3677_2.png) [@fyusuke](https://forum.sierrawireless.com/u/fyusuke)\
**Post date:** [October 10, 2018, 3:48am UTC](https://forum.sierrawireless.com/t/how-to-know-whether-tcp-connection-is-alive/14088/5 "2018-10-10T03:48:37Z")

</div>

I got it. So the result of AT+KTCPSTAT may not be correct. I need to actually send some data to see if the TCP connection is alive, right?
