🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer.misc
Article #193

Re: Sockets prog problems/questions; recv stays blocked when other end dies

#193
From: Jake Coughlin
Date: Thu, 30 Mar 1995 00:00
35 lines
2278 bytes
In <3lc25d$kt1@cpcug.org>, kbennett@cpcug.org (Keith Bennett) writes:
>1) Is this behavior correct according to the TCP/IP standard (or
>   convention if there isn't a standard)?

yes.  tcp/ip is a packet-switched (rather than a
connection-switched) protocol simply because the
designers didn't want TCP "connections" to drop when
the network was flakey.  just because you haven't
received any messaged for several hours/days/weeks,
doesn't mean that a TCP "connection" has been severed.

>2) Is there a way to get the recv() to detect the shutdown and
>   return an error code?

use the KEEPALIVE option.  with KEEPALIVE, the stack
will send a packet every few minutes or hours.  if it
doesn't receive an acknowledgement, the next recv() will
fail.

>   A slightly different solution would still have a separate thread
>   checking the other machines, but instead of pinging have a
>   separate special purpose socket with periodic keepalive
>   messages.  It is our understanding that sockets are more
>   reliable than ping (tcp vs. udp) and that sending messages
>   across an open socket would require less overhead than ping.
>   (Is that correct?)

no, it's totally bogus.  how do you think PING
works anyway?  (a hint: it doesn't use either TCP
or UDP.)
__
\/ Jake Coughlin, [jakec@vnet.net (preferred), coughlin@wg.com]
"I suspect the INI files. I almost always suspect the INI files. I hate
those things. They are full of deep dark secrets, unfathomable to most
of the great unwashed!" -- Darcy B. Hager (Darcy.Hager@UAlberta.CA)
Technical Details
Message-ID: <3lehve$mcl@chaos.wg.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3lc25d$kt1@cpcug.org>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cd94,d2ec22b1757b70e6
X-Google-Attributes: gid10cd94,public
X-Google-Thread: 106983,d2ec22b1757b70e6
X-Google-Attributes: gid106983,public
X-Google-Thread: 11307a,d2ec22b1757b70e6
X-Google-Attributes: gid11307a,public
From: coughlin@wg.com (Jake Coughlin)
Subject: Re: Sockets prog problems/questions; recv stays blocked when other end dies
Date: 1995/03/30
Message-ID: <3lehve$mcl@chaos.wg.com>
X-Deja-AN: 100531470
references: <3lc25d$kt1@cpcug.org>
organization: Wandel and Goltermann, RTP, NC
reply-to: jakec@vnet.net (Jake Coughlin)
newsgroups: comp.os.os2.programmer.misc,comp.os.os2.networking.tcp-ip,bit.listserv.os2-l