Re: Able to detect disconnect, except one weird case...



Just a hint, enable SO_KEEPALIVE option on a socket
(http://msdn.microsoft.com/en-us/library/ms740476.aspx) and see if it helps.

--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
<eselk2003@xxxxxxxxx> wrote in message
news:236e7893-5b34-4bf8-85dd-39b1f052f466@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm using winsock, with WSAEventSelect on the client side. I get
events correctly for FD_CLOSE, FD_CONNECT and FD_READ (the 3 I need).
Only problem is when my client sits silent with no data being
transfered for a long period of time (a couple hours maybe, never
timed it exactly), at that point the server knows the connection has
been closed, but the client doens't get the FD_CLOSE event (or
FD_READ) like it does when the server disconnects. First of all, I'm
not sure what is closing the connection, but I'm not really worried
about that (I imagine there are various timeouts at different levels,
maybe even the router and ISP levels)... as long as I can detect the
disconnect, that is all I care about.

On other projects I've sent keep-alive packets (just small packets
that my client/server ignores) every minute or so, which do keep the
connection open and also let me detect errors... but on this project
I'd rather not do that if I don't need to. I don't mind getting
disconnected every couple hours (or whatever the various timeouts are)
as long as I can detect it and reconnect.


.



Relevant Pages

  • Re: $100 reward for socket disconnection help
    ... > I'm running Java 1.4.1 as an applet on the client side, under Windows 98, ... > with a DSL connection through a Linksys Wireless-B Router. ... > disconnects at the same time my application does ("AOL Instant Messenger ... > still trying to reconnect, IM is always able to immediately reconnect, and ...
    (comp.lang.java.programmer)
  • Re: Mac suddenly disconnected from Windows 2003 Server
    ... Connections can be slept on a per connection basis - the Mac client may or ... monitor tool on the server and looking at the time stamps of the traffic ... >> Most likely the client is sleeping the connection and the server> disconnects>> after not hearing from the client for 2 minutes. ...
    (microsoft.public.win2000.macintosh)
  • Re: $100 reward for socket disconnection help
    ... I'm running Java 1.4.1 as an applet on the client side, under Windows 98, ... with a DSL connection through a Linksys Wireless-B Router. ... client-server disconnects while I run my application are very rare. ... still trying to reconnect, IM is always able to immediately reconnect, and ...
    (comp.lang.java.programmer)
  • Re: Detecting socket disconnection (Async?)
    ... connection or when the connection is lost due to a network error (connect ... When the client explicitly closes the connection, your recieve callback will ... disconnects, but all of them I have seen are Synchronous. ...
    (microsoft.public.dotnet.languages.csharp)
  • Able to detect disconnect, except one weird case...
    ... with WSAEventSelect on the client side. ... at that point the server knows the connection has ... FD_READ) like it does when the server disconnects. ... On other projects I've sent keep-alive packets (just small packets ...
    (microsoft.public.win32.programmer.networks)

Loading