home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!uka!irau35!s_uriart
- From: s_uriart@irau35.ira.uka.de (Juan Uriarte)
- Newsgroups: comp.unix.ultrix
- Subject: Sockets on a 5000/120
- Date: 12 Nov 1992 17:01:47 GMT
- Organization: University of Karlsruhe, FRG
- Lines: 24
- Distribution: world
- Message-ID: <1du2lrINNiue@iraul1.ira.uka.de>
- NNTP-Posting-Host: irau35.ira.uka.de
-
- Hi.
- Im trying to do the following:
- start a process on a socket (a daemon)
- wait for someone to call
- fork and exec a process for the caller
-
- I can do all but i cant change stdin and stdout of the exec'ed
- process to the socket.I've tried 3 aprouches now and none will
- work.First directly dup2 of stdout to the socket,wont work.
- Them creating a pipe and having 3 processes in the background,
- one reads from the pipe and writes into the socket,another reads
- the socket and writes into the pipe,while the third does and exec
- of the program i want to run after changing stdin and stdout to
- the ends of the pipes.But the damned system wont let me close
- stdin and stdout,so it just wont work.And now i just did something
- like: fd=dup(socket); myfile=fopen(fd,"r+'); and then a dup2 .
- But as usual the dup2 wont work,giving me the habitual errno 9.
- I can write into the socket with fprintf(myfile,"something\n"),
- and see at the other end what i wrote(after fflush),but i want it
- to be completely transparent to program being exec'd.
- Any clues? Any pointer for TSM?
- Thanks in advcance.
- BTW:if you didnt notice i am new to unix.Did a two week course,just
- to get my actual account,but that was obviously not enough.
-