Hello,
I have an Application which is a Tcp Server. Many PDA connect to it
(Wireless) and the work goes on successfully. However one problem is
identified as it is tested for connection reset.
Here is the details of problem:
When a connected wireless client is disconnected normally by closing the
socket, the Server correctly detect this and connection cleanup Code runs.
But if the PDA is physically disconnected or switched off, then the
connection closed (or FD_CLOSE) event is not raised at Server, due to which
Connection cleanup code is not running, until approx. 10 minutes (after
which the Disconnect event occurs and cleans-up resources).
Also, if the connection is created with a wired device, then this problem
doesn't occur. The Disconnected event is raised as soon as the device
unplugged or switched off. Therefore, things are OK, with wired devices.
I am Interested in knowing, What is so different in both, such that the
behaviour of TCP/IP is changed ?
Also, Is any Suggestion to over come from this problem. I tried the
"SO_KEEPALIVE" option of WinSock, but didn't helped. I called the
setsockopt() function like this-
//==================================
>> BOOL bTcpKeepAlive = TRUE ;
>> nResult = setsockopt(skNewConnection, SOL_SOCKET, SO_KEEPALIVE,
(LPCSTR)&bTcpKeepAlive, sizeof(BOOL) ) ;
//==================================
Is there any option to set the duration of Keep_Alive Packets ?
Any Suggestions Please ...
Regards.
-Vipul Pathak ;
|