Bob
Fri Jul 23 18:49:03 CDT 2004
David,
Thanks for the ideas. I was trying to avoid the "ping" idea since this
solution is primarily a one way conversation: the client asking the server
for information. However, every two hours for the keep alive is acceptable
in our case, since it is primarily for cleanup and freeing resources.
Thanks again,
Bob
"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:eUixzgQcEHA.2908@TK2MSFTNGP10.phx.gbl...
>
> "Bob L." <nospam.info2@libertyfamily.net> wrote in message
> news:euFfZrPcEHA.212@TK2MSFTNGP12.phx.gbl...
> > Hi, everyone,
> >
> > I am trying to test a client/server solution that uses the .NET Socket
> class
> > (blocking mode on the server). I need the server to be able to verify
that
> a
> > socket is still valid in case the client app drops the connection (i.e.
> the
> > client app crashes). The Poll method and the Available and Connected
> > properties always return the same value regardless if the connection is
> > valid or not. Using the Receive(w/ Peek) method also does not work since
> it
> > waits for incoming data if the connection is valid. Any suggestions on
how
> > to efficiently check the connection?
> >
>
>
> Aparently there are only two ways to do this.
>
> Build a periodic "ping" into your conversation protocol or use the
> SO_KEEPALIVE socket option. The problem with the SO_KEEPALIVE option is
> that the keepalive packets are sent, by default, only every two hours.
This
> interval is configured in the registry and is system-wide.
>
> From
>
http://www.microsoft.com/windows2000/techinfo/howitworks/communications/networkbasics/tcpip_implement.asp
>
>
> HKEY_LOCAL_MACHINE
> \SYSTEM
> \CurrentControlSet
> \Services:
> \Tcpip
> \Parameters
>
> KeepAliveTime
> Key: Tcpip\Parameters
> Value Type: REG_DWORD-time in milliseconds
> Valid Range: 1-0xFFFFFFFF
> Default: 7,200,000 (two hours)
> Description: The parameter 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 acknowledges the
> keep-alive transmission. Keep-alive packets are not sent by default. This
> feature may be enabled on a connection by an application.
>
> David
>
>