Solutions to problem
I am in the midst of writing a client application that requires some rather strange behaviour. From what i have decided i will be needing two threads, one thread to constantly be blocked on a recv call, processing information when it is received and sending replies back, and another thread to ensure that the connection has not been broken (it will sleep for 5 minutes then use a send call to ensure the connection is still live). Hopefully that was not too confusing. I have looked into timeout options in the TCP layer but quickly realised i should not be touching those values since on windows anways it would change the timeout behaviour for all applications and 2 hours is simply too long. Pretty much i just want people to let me know if they believe it is feasible to implement this on windows using threads and blocking socket calls or suggest alternate solutions.
you know you can save yourself the threads and just use select() to check if there is incoming data before you call a blocking function such as recv().
you can read about select() here: Beejís Guide to Network Programming
stacktrace >> what you outlined is a very common practive among networking applications. What you are doing is sending "keep alive" packets to the server in order to keep the connection open, and to know if/when it's been closed. Instead of waiting 5 minutes in between keep alive packets though, I suggest a smaller time frame (maybe 30 seconds).