Re: socket blocks forever if peer machine shuts down or network cable unplug
From: Karish (menih_at_hotmail.com)
Date: 08/25/04
- Next message: Bhamid: "RasEnumDevices returns an ISDN modem even after the Device is remo"
- Previous message: Vincent Fatica: "Re: Can't VPN or RD for 5 min. after logon?"
- In reply to: Arkady Frenkel: "Re: socket blocks forever if peer machine shuts down or network cable unplug"
- Next in thread: Chris P. [MVP]: "Re: socket blocks forever if peer machine shuts down or network cable unplug"
- Reply: Chris P. [MVP]: "Re: socket blocks forever if peer machine shuts down or network cable unplug"
- Messages sorted by: [ date ] [ thread ]
Date: 25 Aug 2004 09:46:19 -0700
I do not want to use a timeout logic, becuase it defeats teh purpose.
If it is too long, user is blocked and software is useless anyway. If
it is too short, you might terminate a legitemet request which just
take longer time to execute.
Meni
Arkady Frenkel wrote:
> Why not , exactly for that Winsock2 offer
> SO_RCVTIMEO/SO_SNDTIMEO in setsockopt
>
> Arkady
>
>
>
> "Alexander Nickolov" <agnickolov@mvps.org> wrote in message
> news:%23XLZKSTiEHA.556@tk2msftngp13.phx.gbl...
> > Don't use blocking sockets. Somehow the others failed to
> > mention this prerequisite for their solutions...
> >
> > --
> > =====================================
> > Alexander Nickolov
> > Microsoft MVP [VC], MCSD
> > email: agnickolov@mvps.org
> > MVP VC FAQ: http://www.mvps.org/vcfaq
> > =====================================
> >
> > "Meni" <menih@hotmail.com> wrote in message
> > news:ffd819cc.0408220047.5e635476@posting.google.com...
> > > Hi,
> > >
> > > my acpplication calls recv() and blocks forever. This occur when
peer
> > > machine suddenly shuts down or network cable unplugged. The same
> > > behavior will occur on send() or a blocking select().
> > >
> > > My code does call select() to check if the socket is readable,
which
> > > returns 1 (readable). This is expected as windows does not know
there
> > > is anything wrong with the other side's network, or machine.
There is
> > > not oppertunity for the other side to signal that the socket had
> > > closed.
> > >
> > > I am reluctant to use non blocking select() with timeout. some
server
> > > operations might take some time and setting a short timeout might
> > > defeat servicibility. KEEPALIVE would also not going to help,
because
> > > it suffers a long duration before finally timing out. I need some
> > > immidate way to know peer is gone.
> > >
> > > Does anyone know any way to over come this?
> > >
> > > Thanks,
> > >
> > > Meni
> >
> >
- Next message: Bhamid: "RasEnumDevices returns an ISDN modem even after the Device is remo"
- Previous message: Vincent Fatica: "Re: Can't VPN or RD for 5 min. after logon?"
- In reply to: Arkady Frenkel: "Re: socket blocks forever if peer machine shuts down or network cable unplug"
- Next in thread: Chris P. [MVP]: "Re: socket blocks forever if peer machine shuts down or network cable unplug"
- Reply: Chris P. [MVP]: "Re: socket blocks forever if peer machine shuts down or network cable unplug"
- Messages sorted by: [ date ] [ thread ]