From owner-freebsd-questions@FreeBSD.ORG Fri Nov 7 09:36:12 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA25216A4CE for ; Fri, 7 Nov 2003 09:36:12 -0800 (PST) Received: from pi.codefab.com (pi.codefab.com [66.234.138.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC97343FD7 for ; Fri, 7 Nov 2003 09:36:11 -0800 (PST) (envelope-from cswiger@mac.com) Received: from [10.1.1.193] (dpvc-68-161-244-25.ny325.east.verizon.net [68.161.244.25]) by pi.codefab.com (8.12.9p2/8.12.10) with ESMTP id hA7HZtEC070724; Fri, 7 Nov 2003 12:35:56 -0500 (EST) In-Reply-To: <20031107091909.6d2a0acc.cpressey@catseye.mine.nu> References: <20031107091909.6d2a0acc.cpressey@catseye.mine.nu> Mime-Version: 1.0 (Apple Message framework v606) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Fri, 7 Nov 2003 12:35:55 -0500 To: Chris Pressey X-Mailer: Apple Mail (2.606) X-Spam-Status: No, hits=0.0 required=7.0 tests=none autolearn=no version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on pi.codefab.com cc: FreeBSD-Questions Subject: Re: [OT?] Tying a socket to stdin/stdout w/dup2() ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Nov 2003 17:36:12 -0000 On Nov 7, 2003, at 12:19 PM, Chris Pressey wrote: > I've got a C program that opens a TCP/IP socket and makes a client > connection. What I'd like to do is to 'tie' the socket to this > program's standard I/O, so that anything that is fed into this > program's > stdin, is immediately sent to the socket, and anything that appears on > the socket, is immediately sent out this program's stdout. (The end > effect being a sort of pathologically simple version of what telnet, > (or inetd or ucspi-tcp) does.) Take a look at netcat, from /usr/ports/net/netcat. -- -Chuck