On Thu, 7 Feb 2002, Brett Parker - Tech Support wrote:
erm - why not: command1 | command2 | command3
The data stream needs to be continuous. One is a simulation package (swarm.org), the other a visual programming music thing (pure-data.org). I need consistent data out of PD, into swarm, out of swarm and back to PD.
or am I not getting the point here?
No, just a *nix-peasant asking vague questions...
Cheers, DC
david casal --0+ --- d.casal@uea.ac.uk --9+ --- www.ariada.uea.ac.uk/~dcasal --)+
on Thu, Feb 07, 2002 at 11:02:44AM +0000, david casal wrote:
The data stream needs to be continuous. One is a simulation package (swarm.org), the other a visual programming music thing (pure-data.org). I need consistent data out of PD, into swarm, out of swarm and back to PD.
man socketpair
just treat the resulting file descriptors like they came from pipe(2) except they're bi-directional. Most *nix only implement socketpair in the unix domain. The unix(7) man page has details.
If you dup2 one of the resulting descriptors onto the stdin,stdout and stderr of each process then exec them, they should talk happily. eg: (this ommits error handling)
int fds[2], x;
socketpair(PF_UNIX, SOCK_STREAM, 0, fds); switch(fork()) { case -1: err(1, "fork");
case 0: for (x = 0; x < 3; x++) dup2(fds[0], x); close(fds[0]); close(fds[1]); execlp("swarm", ...blah...); _exit(0); default: for (x = 0; x < 3; x++) dup2(fds[1], x); close(fds[0]); close(fds[1]); execlp("pd", ... blah...); break; }
(it's still before 12, there are likely mistakes in this) It is possible to do it with pipe(2), but it uses twice as many file descriptors. If all doesn't seem right, don't dup2 stderr (fd 2) for each process and see what happens.
On Thu, 7 Feb 2002 xsprite@bigfoot.com wrote:
man socketpair
wow
int fds[2], x;
(it's still before 12, there are likely mistakes in this) It is possible to do it with pipe(2), but it uses twice as many file descriptors. If all doesn't seem right, don't dup2 stderr (fd 2) for each process and see what happens.
I understood about half that message, so I'm off to do some reading, then try this stuff out.
thanks!
DC
david casal --0+ --- d.casal@uea.ac.uk --9+ --- www.ariada.uea.ac.uk/~dcasal --)+
on Thu, Feb 07, 2002 at 12:15:18PM +0000, david casal wrote:
It is possible to do it with pipe(2), but it uses twice as many file descriptors. If all doesn't seem right, don't dup2 stderr (fd 2) for each process and see what happens.
I understood about half that message, so I'm off to do some reading, then try this stuff out.
Ah sorry! afaik, you can't do it outside of some c code. zsh has a pipeline option "coproc" that appears to do what you want, but I'm not quite sure how (and my attempts to use it in the recommended way seem to make zsh die)
(btw, your mail server bounces messages to you: 139.222.230.4 does not like recipient. Remote host said: 550- 550 mail from 62.253.51.34 rejected: administrative prohibition Giving up on 139.222.230.4.
I guess this is the evil and somewhat pointless DUL MAPS dns thing being used somewhere..)
On Thu, 7 Feb 2002 xs@kittenz.org wrote:
(btw, your mail server bounces messages to you: 139.222.230.4 does not like recipient. Remote host said: 550- 550 mail from 62.253.51.34 rejected: administrative prohibition Giving up on 139.222.230.4.
Blame UEA (and the rest of JANET afaict) for using the DUL MAPS thing. Blame BT for listing you on it in the first place.
Not much David can do, sadly (other than hack the UEA mailserver). Thankfully the alug list is a little more laid back (s/laid back/properly configured/) and will pass the message on regardless.
Andrew.
On Thu, 7 Feb 2002 xs@kittenz.org wrote:
Ah sorry! afaik, you can't do it outside of some c code. zsh has a pipeline option "coproc" that appears to do what you want, but I'm not quite sure how (and my attempts to use it in the recommended way seem to make zsh die)
Oh, right. So say I write that bit of C at the output end of a PD external object......or maybe just a shell script?
(btw, your mail server bounces messages to you:
NTL. Urgh...
DC
david casal --0+ --- d.casal@uea.ac.uk --9+ --- www.ariada.uea.ac.uk/~dcasal --)+
on Thu, Feb 07, 2002 at 03:34:47PM +0000, david casal wrote:
Oh, right. So say I write that bit of C at the output end of a PD external object......or maybe just a shell script?
http://kittenz.org/xs/stuff/bi-pipe.c is the source to a program that should (I think) do what you want. It pipes the standard output into the standard input of another program and vice versa.
(btw, your mail server bounces messages to you:
NTL. Urgh...
NTL are being far more reliable than BT"open"world. So far their (BTopenworld) equipment has been here a week, but is unusable because they double allocated our static ip subnet. On Friday it was "we'll fix it by Tuesday next week!", on Monday it was "It'll be fixed by Thursday no problem!". Today it was "we'll fix it by Tuesday next week!"
On Thu, 7 Feb 2002 xs@kittenz.org wrote:
http://kittenz.org/xs/stuff/bi-pipe.c is the source to a program that should (I think) do what you want. It pipes the standard output into the standard input of another program and vice versa.
Wow thanks! Will run today as soon as I get to a workstation with a sane compiler...
NTL are being far more reliable than BT"open"world. So far their (BTopenworld) equipment has been here a week, but is unusable because they double allocated our static ip subnet. On Friday it was "we'll fix it by Tuesday next week!", on Monday it was "It'll be fixed by Thursday no problem!". Today it was "we'll fix it by Tuesday next week!"
Nightmare. My kingdom for cheap broadband.
dc
david casal --0+ --- d.casal@uea.ac.uk --9+ --- www.ariada.uea.ac.uk/~dcasal --)+
XS wrote:
I guess this is the evil and somewhat pointless DUL MAPS dns thing being used somewhere..)
Yes, via the JANet mail-abuse service, I believe. There are better systems available, but I guess we have to be thankful that they haven't implemented one of the worse ones...