Re: Sockets and timeouts

From: Eric Taylor (et2_at_rocketship1.com)
Date: 10/25/05


Date: Tue, 25 Oct 2005 12:58:13 -0700

Well, I don't have a best way to do this, but consider
that when you disconnect the hardware between the
computers, this is no different than if one system crashed
or had a power hit. Thus the only way the surviving system
is going to know this is by some form of timeout.

AFAIK unless some router or other system knows tthat
your partner is down, it can take minutes before there
is a true timeout. And in that case, you would need to
either poll or have some sort of pending operation.

The Steven's book on this suggests that you place your
own timeouts on operations. However, I'm not certain
this works on writes, since they can complete as soon
as the tcp layer has room to buffer your request. In my
feeble case, I periodically poll the read side of my sockets
to see if I get any error returns. But I'm not sure I can
detect a lost connection any faster this way. But I can
detect when the other side closes it's socket. Otherwise
I wouldn't know this until I was ready to do my next
write operation.

I thnk that the sigpipe signal only occurs when you try to
do more operations on a connection that has been closed
because you ignored an error return. So, you will not
have that in your case until some timeout occurs. Again,
this could be a long time.

Francois Goudal wrote:

> Hi,
>
> I'm currently writing my first server software using sockets.
> It currently works fine but :
> When I connect a client to it (just a telnet for example) and then I
> disconnect the RJ45 between my two computers, the server can't detect
> that the link is down and so that the connection have to be closed.
> I just read about handling SIGPIPE but i'm not sure about this.
> Could someone tell me the best way to do that ?
>
> Thank's
>
> --
> Francois Goudal



Relevant Pages

  • Re: RWW Disconnect Issue
    ... computers. ... the connection, they get disconnected. ... own default inactivity disconnect setting as well as an inactivity ...
    (microsoft.public.windows.server.sbs)
  • Re: OE6 does not connect with pop3 server
    ... Can we infer from this that you got a timeout on the EarthLink account ... My point about making an approximate timestamp is just to look at the ... E.g. as near as possible before the connection ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Timout control with RPC/HTTP
    ... specifies the minimum connection timeout used by the ... client and RPC Proxy, in seconds. ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.exchange.admin)
  • Re: Timout control with RPC/HTTP
    ... please also check the RPC web site connection timeout settings ... Maybe the idle timeout settings depend on here. ...
    (microsoft.public.exchange.admin)
  • Re: web serivce: client side timeout?
    ... client side but only from the server side. ... System.Net.Sockets.SocketException: A connection attempt failed ... asyncResult, Int32 timeout, Exception& exception) ... John Saunders | MVP - Windows Server System - Connected System ...
    (microsoft.public.dotnet.framework.webservices)