From owner-freebsd-questions@freebsd.org Tue Apr 20 16:17:47 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCAF75DDF3A for ; Tue, 20 Apr 2021 16:17:47 +0000 (UTC) (envelope-from pprocacci@gmail.com) Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPpkM1kcVz3Bp5 for ; Tue, 20 Apr 2021 16:17:47 +0000 (UTC) (envelope-from pprocacci@gmail.com) Received: by mail-pg1-x52c.google.com with SMTP id 31so11471011pgn.13 for ; Tue, 20 Apr 2021 09:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jXIg29p/VoOlioEblYgS0SO6RgF4/pMrxbsbU2fM9Ug=; b=qqRx8BXwzrY3K+Kl3wFBnDywbsWXvwHlxnwSZMIKJSoCLk95yowgmCI0yjjNqIzCgU GG1j6aQjsDHkwVJU72bQwuIw9idZLREtzNP41Ckj6xF7bdz8YDVycBZc8bOiBInQWDoT QVjt6kMmON5padINOR8ubrSDFN8iqzrHiMklAm2LB6zSr5C38SxcBGf9pDsfukE6l1bP 4bEOSrGk+1wkWnOFAKHTCPm21kDFvASOK46Jmbqd2pluhy2qubV6RhvM2tWZthAP4vDD b/8Wraee/vO9djSRUWbcrqIjqcPtsd9HY/caZOfzbqXnpXGL2X6F8OCiGI0XgWz7VRK3 P1WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jXIg29p/VoOlioEblYgS0SO6RgF4/pMrxbsbU2fM9Ug=; b=uJSNIKTK+4NdJdHPlKyGR08ijBCJi4UEudkt6/97LYoG8BayiRqCl0jFWbWIh57Wsb qqnjVzPsuInFzqQvjSNaqnyNH2VMpBOoXsBs04Wz11f2v7NwSa9UZ9dw3pBkj2P/cw2Y u9bp7A7DBwaewLM2MgaHi2DXQAB18lFOuvp8uEAIQyKNewqTz6VVXJjUouuR99BD9oEu MC5RqAi2vz0JxCQoSyfV8m4iyGIJ5R+34AzNIai0RJ1oo2waw2UOjpjcY+G1Laq2gSol XCPWrgMHdRc6eF/Jydj+HtLuOgSBXS5jAZ0Vu3mlGCOzWSc7Ye8bhFBleLK6LHlxYcpM NjkQ== X-Gm-Message-State: AOAM530+TgeVNzO1+pXxYQ9nXzgyuuHxD59+g2K/CsU8Byq0+d/IS2Tj nxoCKB5W9BM+YJAACPVA3UhypsX0dMoPmdtOTwdCmCi7rAIy X-Google-Smtp-Source: ABdhPJwoD0zxYBeRuZu0Ow9dw+BJ7o1hBhNNOUlrJPSqrJd+I0GqBNp4PPvzTpg4kUkENwMBmntRtveu0D0xkVt7u4w= X-Received: by 2002:a62:e203:0:b029:260:d99:57bb with SMTP id a3-20020a62e2030000b02902600d9957bbmr10531778pfi.31.1618935465024; Tue, 20 Apr 2021 09:17:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Paul Procacci Date: Tue, 20 Apr 2021 12:17:32 -0400 Message-ID: Subject: Re: socat / ghostscript questions To: byrnejb@harte-lyne.ca Cc: FreeBSD Questions X-Rspamd-Queue-Id: 4FPpkM1kcVz3Bp5 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=qqRx8BXw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of pprocacci@gmail.com designates 2607:f8b0:4864:20::52c as permitted sender) smtp.mailfrom=pprocacci@gmail.com X-Spamd-Result: default: False [-3.54 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.54)[-0.539]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::52c:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::52c:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::52c:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 16:17:47 -0000 The hang is most likely because an EOF doesn't get trasmitted over the wire. Adding a timeout I believe should fix the problem. nc -w 1 [addr] [port] < filename.txt On Tue, Apr 20, 2021 at 11:51 AM James B. Byrne via freebsd-questions < freebsd-questions@freebsd.org> wrote: > I am trying to produce pdf files using socat and ghostscript. I have this > command for socat: > > socat TCP4-LISTEN:9100,bind=192.168.216.41,fork,reuseaddr SYSTEM:'gs > -dQUIET > -dNOPROMPT -dBATCH -sDEVICE=pdfwrite -sOutputFile=/tmp/\"$(date > -Iseconds)\".pdf -' > > > Which I try to send a text file to using cat and nc: > > cat sshpipe3.txt | nc 192.168.216.41 9100 > > > What happens is that the cat/nc pipe hangs. This is probably an artifact > of > how nc works but I need to check that is so. When I terminate nc with > -c > the socat gs instance reports an error: > > GPL Ghostscript 9.52: Unrecoverable error, exit code 1 > 2021/04/20 11:32:51 socat[67296] E write(6, 0x800adf000, 128): Broken pipe > > This produces an empty file named like /tmp/2021-04-20T11:13:20-04:00.pdf. > > I am no doubt missing the obvious here so I have a few naive questions: > > 1. Is it possible to terminate the sending process without causing GS to > issue > an error? > > 2. Would printing from another host to that socat instance result in the > same > broken pipe error? > > 3. Why are the files that gs creates empty? > > 4. How do I send a text file to the socat instance so that it is converted > to a > pdf document? > > -- > *** e-Mail is NOT a SECURE channel *** > Do NOT transmit sensitive data via e-Mail > Unencrypted messages have no legal claim to privacy > Do NOT open attachments nor follow links sent by e-Mail > > James B. Byrne mailto:ByrneJB@Harte-Lyne.ca > Harte & Lyne Limited http://www.harte-lyne.ca > 9 Brockley Drive vox: +1 905 561 1241 > Hamilton, Ontario fax: +1 905 561 0757 > Canada L8E 3C3 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" > -- __________________ :(){ :|:& };: