From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 27285 invoked from network); 28 Mar 2020 16:04:33 -0000 Received-SPF: pass (minnie.tuhs.org: domain of minnie.tuhs.org designates 45.79.103.53 as permitted sender) receiver=inbox.vuxu.org; client-ip=45.79.103.53 envelope-from= Received: from unknown (HELO minnie.tuhs.org) (45.79.103.53) by inbox.vuxu.org with ESMTP; 28 Mar 2020 16:04:33 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id AD5FE9D718; Sun, 29 Mar 2020 02:04:29 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 7D6549D577; Sun, 29 Mar 2020 02:04:03 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 3EA879D577; Sun, 29 Mar 2020 02:04:00 +1000 (AEST) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by minnie.tuhs.org (Postfix) with ESMTPS id 642CE9D56C for ; Sun, 29 Mar 2020 02:03:59 +1000 (AEST) Received: by sdaoden.eu (Postfix, from userid 1000) id CEC0F16054; Sat, 28 Mar 2020 17:03:56 +0100 (CET) Date: Sat, 28 Mar 2020 17:03:55 +0100 From: Steffen Nurpmeso To: Peter Pentchev Message-ID: <20200328160355.NCc9a%steffen@sdaoden.eu> In-Reply-To: <20200328111428.GA1431416@straylight.m.ringlet.net> References: <5dbf2153-5993-242a-5ba9-54b49a38569e@spamtrap.tnetconsulting.net> <20200323084943.GA341861@straylight.m.ringlet.net> <20200324094710.GB83316@clarinet.employees.org> <127f7c5c-a607-8f5b-1760-5a308c279836@tnetconsulting.net> <20200328111234.GA342169@straylight.m.ringlet.net> <20200328111428.GA1431416@straylight.m.ringlet.net> Mail-Followup-To: Peter Pentchev , The Eunuchs Hysterical Society User-Agent: s-nail v14.9.17-52-g56288e6a OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [TUHS] sockets (was Re: First appearance of named pipes) X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Peter Pentchev wrote in <20200328111428.GA1431416@straylight.m.ringlet.net>: |On Sat, Mar 28, 2020 at 01:12:35PM +0200, Peter Pentchev wrote: |> On Thu, Mar 26, 2020 at 01:38:17PM +1100, Dave Horsfall wrote: |>> On Wed, 25 Mar 2020, Grant Taylor via TUHS wrote: |>>=20 |>>> =C2=B7 netcat's STDOUT to grep's STDIN |>>> =C2=B7 grep's STDOUT to netcat's STDIN |>>=20 |>> Are you trying to set up a loop of processes or something? I'm \ |>> not sure if |>> that is even possible, although you can't rule out creative uses \ |>> of dup2() |>> etc... |>=20 |> This can't really be done with netcat, but it's quite easy to do with |> socat; here's an example with a trivial program that reads lines from |> its standard input and writes a single line to its standard output: |>=20 |> [roam@straylight ~]$ socat -v tcp4:nimbus.fccf.net:25 exec:./heysmt= p.\ |> py ... perl(1) has IPC::Open2 for that: use IPC::Open2; # We use `csop' for hashing my $MAILX =3D 'LC_ALL=3DC s-nail -#:/'; sub hash_em{ die "hash_em: open: $^E" unless my $pid =3D open2 *RFD, *WFD, $MAILX; foreach my $e (@ENTS){ print WFD "csop hash32 $e->{name}\n"; my $h =3D ; chomp $h; $e->{hash} =3D $h } print WFD "x\n"; waitpid $pid, 0; } hash_em() |...but, of course, this is still not what Derek was talking about |earlier - there is no separation of the file descriptors connected to |the socket: closing the stdout one would not result in a FIN being sent |along the line. Just wanted to add earlier in the thread that on some systems shutdown(2) equals close(2). At least it was like that on Mac OS X (by then) Snow Leopard. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)