Re: Notification when network connection loss...
From: OMAR [MS] (omarm_at_online.microsoft.com)
Date: 09/01/04
- Next message: Arvind: "Re: Encryption/Decryption"
- Previous message: Don Dumitru [MSFT]: "Re: Encryption/Decryption"
- In reply to: Nutty103: "Notification when network connection loss..."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 31 Aug 2004 17:31:41 -0700
For sends the tcp stack will retry sending the data 5 times by default.
After each send it will back off exponentially. The exact amount of time
this takes will be determined by your rtt, but since this is usually in
seconds it won't really take a long time usually a minute or so. However,
when you call recv, if the other end disappears without sending a reset, it
will take up to the keep-alive time specified in the registry before
failing.
This is b/c a recv doesn't generate any packets on the wire, and if the
other side doesn't send a packet saying it is going away, you won't be the
wiser. The keep-alive time however, specifies that a host should send
keep-alive packets by such time. By setting this setting lower, you can
lower the amount of time it takes a recv to know that the connection is
broken.
To modify the time change the following value under:
HKEY_LOCAL_MACHINE\Comm\Tcpip\Parms
KeepAliveTime : REG_DWORD Default setting is 7,200,000 (two hours).
This value controls how often TCP attempts to verify that an idle connection
is still intact by sending a keep-alive packet. If the remote system is
still reachable and functioning, it will acknowledge the keep-alive
transmission. Keep-alive packets are not sent by default. This setting may
be enabled on a connection by an application. The valid range for this value
is 1-0xFFFFFFFF (hexadecimal). For more information, see TCP Keep-Alive
Messages.
Remember that the setting is in milliseconds!
Here is a snippet from the docs about the keep-alive option:
Windows CE Features > Communication Services and Networking > Networking -
General > TCP/IP > TCP/IP Application Development > Core Protocol Stack for
IPv4 > Transmission Control Protocol (TCP)
A TCP keep-alive packet is simply an ACK with the sequence number set to one
less than the current sequence number for the connection. A host receiving
one of these ACKs will respond with an ACK for the current sequence number.
Keep-alives can be used to verify that the computer at the remote end of a
connection is still available. TCP keep-alives can be sent once every
KeepAliveTime (defaults to 7,200,000 milliseconds or 2 hours), if no other
data or higher-level keep-alives have been carried over the TCP connection.
If there is no response to a keep-alive, it is repeated once every
KeepAliveInterval seconds. KeepAliveInterval defaults to 1 second. NetBT
connections, such as those used by many parts of the Microsoft networking
functionality, send NetBIOS keep-alives more frequently, so usually no TCP
keep-alives will be sent on a NetBIOS connection. TCP keep-alives are
disabled by default, but Windows Sockets applications can use the SetSockOpt
function to enable them.
Thanks,
- Omar
-- This posting is provided "AS IS" with no warranties, and confers no rights. Please do not send email directly to this alias. This alias is for newsgroup purposes only. "Nutty103" <Nutty103@discussions.microsoft.com> wrote in message news:366BD34B-1F61-4376-BF8D-F9E181E24019@microsoft.com... > I am working on an application that communicates with server. I have a socket > connection established with the server from the CE device. I run in to > problem whenever there is a connection loss. > > The send and recv calls of sockets don't realize the connection loss for > long time. I have read that it takes upto 2 hours for TCP request to die > before the CE device can realize the network loss. Is this true? One solution > could be to use PING, but it is not a suitable option. > > I really appreciate any help. > > Thanx. > Nutty103@yahoo.com
- Next message: Arvind: "Re: Encryption/Decryption"
- Previous message: Don Dumitru [MSFT]: "Re: Encryption/Decryption"
- In reply to: Nutty103: "Notification when network connection loss..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|