Re: Sockets and timeouts
From: Eric Taylor (et2_at_rocketship1.com)
Date: 10/25/05
- Next message: Perianayagam Somasundaram: "Checksum code for i386 in the kernel."
- Previous message: Tauno Voipio: "Re: need help in developing a secure encrypted filesystem for a usb pendrive"
- In reply to: Francois Goudal: "Sockets and timeouts"
- Next in thread: David Schwartz: "Re: Sockets and timeouts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Perianayagam Somasundaram: "Checksum code for i386 in the kernel."
- Previous message: Tauno Voipio: "Re: need help in developing a secure encrypted filesystem for a usb pendrive"
- In reply to: Francois Goudal: "Sockets and timeouts"
- Next in thread: David Schwartz: "Re: Sockets and timeouts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|