How to know whether TCP connection is alive


#1

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


#2

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


#3

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.


#4

@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


#5

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?