Return to BSD News archive
Xref: sserve comp.unix.bsd:12331 comp.unix.misc:8511 comp.unix.programmer:10754 comp.unix.questions:37093 Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!swrinde!pirates.cs.swt.edu!cs.utexas.edu!not-for-mail From: whatis@primus.com (....What Is?....) Newsgroups: comp.unix.bsd,comp.unix.misc,comp.unix.programmer,comp.unix.questions Subject: I/O Routing Date: 28 Jul 1993 13:42:07 -0500 Organization: UTexas Mail-to-News Gateway Lines: 25 Sender: daemon@cs.utexas.edu Message-ID: <9307281843.AA04792@primus.com> NNTP-Posting-Host: cs.utexas.edu I'd like to do I/O routing, the way tip does when you run a remote command. I'd like to spawn the new process so that all input comes from whatever you're tipped to, and all the output goes there too. It seems like that'd be as simple as doing (from the newly-forked child process), if the tipped-to socket number is s, "dup2 (s, 0);" and "dup2 (s, 1);" followed by an exec() call. However, this doesn't seem to work. I can't tell how it's not working, but I find myself at the telnet server that I logged into (rather than the system I telnet'd to -- as if I had sent a break signal). I know I could make it work if I re-routed the I/O by hand, that is, set up a pipe between the child process and the parent process, and have the parent process sit there and route all data coming from the socket to the child process, and all data coming from the child process to the socket. Any ideas why I'm not able to do this directly? Oh, the socket in question here has been put into raw mode. Please e-mail replies; I'll post the answer. If I haven't given enough info, please tell me that too. Steve Boswell whatis@primus.com There is no other possibility.