Re: Able to detect disconnect, except one weird case...
- From: "Volodymyr M. Shcherbyna" <v_scherbina@xxxxxxxxxxxxxxx>
- Date: Mon, 5 May 2008 17:46:37 +0200
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.
.
- Follow-Ups:
- Re: Able to detect disconnect, except one weird case...
- From: eselk2003
- Re: Able to detect disconnect, except one weird case...
- References:
- Able to detect disconnect, except one weird case...
- From: eselk2003
- Able to detect disconnect, except one weird case...
- Prev by Date: Re: Slow registration of group name NetBIOS
- Next by Date: Re: Able to detect disconnect, except one weird case...
- Previous by thread: Able to detect disconnect, except one weird case...
- Next by thread: Re: Able to detect disconnect, except one weird case...
- Index(es):
Relevant Pages
|
Loading