my chat server is a good example. it accepts normal TCP
connections from telnet-type programs. Before, i used to use just write()
to the sockets immediately. When I started logging write() errors, I had
literally tons of EPIPE's. So then I started queueing the output in a
buffer, and used select() to check the writeability of the sockets, and
flushed the output when it became so..and now i very rarely will see a
broken pipe on the flush. And I never have the symptom anymore of a
login session hanging around on the server when someone disconnects from
the internet suddenly..like i used to.
Even just checking for EPIPE on write() or fwrite(), whatever's used,
would allow us to know if we should kill the connection.
-Tony
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
Anthony J. Biacco Network Administrator/Engineer
[EMAIL PROTECTED] Intergrafix Internet Services
"Dream as if you'll live forever, live as if you'll die today"
http://www.asteroid-b612.org http://www.intergrafix.net
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
On Wed, 25 Jul 2001, Kenneth Porter wrote:
> On Tue, 24 Jul 2001 11:16:21 -1000, Clifton Royston wrote:
>
> >When we've seen similar problems, it's usually because TCP does *not*
> >see that the modem connection has gone away; they may have been
> >disconnected, but the old TCP connection is hanging around. I'm not
> >sure why the situation you describe would come up.
>
> A normal TCP connection will live forever without any packets. To get a
> timeout, you need to turn on "keepalives" after you create the
> connection. This forces a packet to be sent periodically, and kills the
> connection if the keepalives aren't seen frequently enough. I don't see
> any reference to keepalives in the qpopper source code, so unless the
> client asks for them, stale connections could have no indication that
> would cause qpopper to kill them. OTOH, your OS may provide keepalives
> by default. Linux, for instance, can be configured to use keepalives on
> all TCP connections using settings in /proc/sys/net/ipv4.
>
> The modem bank should kill any outstanding TCP connections when a modem
> disconnects by sending a RST packet (I think) to the other end. But
> this won't protect you from a break in the connection somewhere else.
>
> Ken
> mailto:[EMAIL PROTECTED]
> http://www.sewingwitch.com/ken/
> [If answering a mailing list posting, please don't cc me your reply. I'll take my
>answer on the list.]
>
>
>