RTCS - TCP disconnect reporting

Discussion created by v.k on Dec 20, 2012
Latest reply on Jan 2, 2013 by v.k

I'm using MQX 3.7 and RTCS for implementing TCP client and server applications. I'm using the RTCS_select function to determine whether some data is available to be read on a socket or not. This works fine except when the remote end has abruptly closed the connection. In this case, select call never reports that there is any data (which it should and when I do a recv it should return an error due to the disconnect). Therefore, I never (well, I waited for more than 5 mins after disconnect) get to know that the connection is no longer alive. However, I've found that if I do a send when the connection has been lost, then I do receive an error, and therefore get to know that the connection does not exist. I guess this is a problem in RTCS, that it does not report TCP disconnects when no activity is taking place on the socket. Any ideas on how to workaround this issue?

I tried using the TCP keep-alive option, but for my case, it is too late. The minimum I can specify is 1 minute.