TCP/IP Time Out

After trying TCP - serial, i have found 2 problems,

  1. that the Presentation driver is not timing out the incomming connection when it is dropped, and can get in a stuck state. how is best to handle this, (time out?)

  2. the serial driver seems to stop other drivers in the embedded web presentation from refreshing once you send data through it.

Please advise on what is needed to move forward.

Take a look at this Wiki page - enabling the TCP Keepalive feature will cause the "orphaned’ TCP socket to eventually close.

However, I personally do it the hard way. I use a timeout in select to (for example) return to my task/thread every 5 or 10 seconds. Then I keep a time-stamp of last socket data received and manually abort a socket which has been idle longer than (for example) 1 minute. This time of course depends on your application.

Another fix would be to enable a 2nd incoming TCP socket for any ‘destination’, which then closes/kicks the old socket out. This can lead to a battle-royal, where two clients fight to own that destination.

Unfortunately these fixes make the already somewhat complex-looking TCP-to-serial example look much harder.