Xref: utzoo comp.unix.questions:30077 comp.unix.wizards:24676 Newsgroups: comp.unix.questions,comp.unix.wizards Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!ftpbox!mothost!fwhnm02!sscott From: sscott@fwhnm02.fwrdc.rtsg.mot.com (Steve Scott) Subject: Passing std in/out file descriptors between processes Message-ID: <1991Apr04.173646.983@fwhnm02.fwrdc.rtsg.mot.com> Reply-To: sscott@mot.com Organization: Motorola Inc., Ft. Worth, Tx Date: Thu, 04 Apr 1991 17:36:46 GMT On my current work assignment, software development is split between a U.S. site and an international site. There is an existing IP ethernet connectivity between the two development sites. Here is what I would like to do: In the US site, I have a "box" which must be controlled via a 2400 baud RS232 port. In the international site, I have an SysVR3.2-based Unix box which wants to control this "box" via a 2400 baud serial port. Trouble is, they are multiple thousands of miles apart. The obvious solution is to use a couple of 2400 baud modems with MNP (for noise pollution protection). The problem is that we do not know for sure how often (or how long) these connections would have to be made. The long distance charges could eat us up. What I have been asked to evaluate is this: Could we connect the "box" to a Unix computer sitting in the US lab via a serial port and let the US Unix computer and the international Unix computer communicate via the existing TCP/IP network? This seems like a complicated matter to me (but I HOPE I am wrong ;-) +------------+ +-----------+ +----------+ | Controlled |---------| US Unix | |Int. Unix | | Box | | Computer| | Computer| +------------+ +-----------+ +----------+ ^ | | | |--------------------------| | 2400 baud ^ RS232 | Existing TCP/IP connection network connection So, is this possible: Could the Int. Unix computer telnet to the US Unix computer, run cu (or tip) to connect to the Controlled box AND once completed, have that whole "chain of communications" inherited by the application running on the Int. Unix computer (which is expecting to talk to a local /dev/tty type of a connection)? I presume that a dumb terminal emulation would have to be used during the telnet session so that terminal control codes are eliminated (or at least minimized ;-). My biggest problem is: How would I get one application in the Int. Unix box (the one expecting to talk to the serial port) to "attach" itself to the telnet session input/output? To the application, I want the standard in/standard out file descriptors associated with the telnet session to appear to be the input/output via a serial port. So, in general, how does one application take over the standard in/ standard out of another application? Is this possible? Can it be done with "standard" Unix programs (tee, et al.) in a shell script? Or will it require some sort of a (dup/close/execl) type of a C program? OR am I all washed up and there is a better way? Any hints, tips, pointers, etc. would be VERY MUCH appreciated. Thanks, -- +------------------------------------------------------------------------------+ | Steve Scott | Internet: sscott@mot.com | | Fort Worth Research and Development Center | UUCP: csccat!camdev!sscott | | Cellular Infrastructure Group | Internal: TX14/1D | | Radio Telephone Systems Group | Voice: (817) 232-6317 | | Motorola, Inc. | Fax: (817) 232-6081 | | The opinions contained herein are STRICTLY my own | +------------------------------------------------------------------------------+