See i also got this idea but what happens if during transmission if network connection is lost than also it will be connected to netowork so it wont show the ERROR 66(This i verified by myself)
As the other solution i cant send any data while i am receiciving the data i.e. inbetween read i cant write data. That is just not possible.
Timeout error is not possible because this is running on the server so input to timeout will be -1. for checking the validity of connection i can check the error(Whether error occured or not) but only when the program terminates but unfortunatelly its not teminating.
--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.
I need my difficulties because they are necessary to enjoy my success.
--Ranjeet