I'm not particularly attached to using open3, I just want a way to connect my stream to to the external program. Am I missing something obvious or is this a limitation of open3? I've been avoiding IPC::Run so far as this will be copied to several computers & I'd prefer not to use a separate module. It's even fine if I can't redirect zfs receive's STDOUT or STDERR, as long as I can just connect STDIN and get the exit status. Thanks!#!/usr/bin/perl use warnings; use strict; use IO::Socket; use IPC::Open3; my $sock = new IO::Socket::INET ( LocalHost => '127.0.0.1', LocalPort => '1818', Proto => 'tcp', Listen => 1, ReuseAddr => 1, Timeout => 20 ); die "Could not create socket: $!\n" unless $sock; ## THIS WORKS (I can telnet to port 1818 from another terminal & see t +he text come across): #my $new_sock = $sock->accept() or die "No one came!"; #while ( <$new_sock> ) { print; } ## THIS WORKS (If I type "cat | ./<this_script>, I can type and see it + echo back): #my $pid = open3( "<&STDIN", ">&STDOUT", ">&STDERR", "/bin/cat" ); #waitpid( $pid, 0 ); # THIS DOES NOT WORK (using open3 to read from a network handle). my $new_sock = $sock->accept() or die "No one came!"; #my $pid = open3( $new_sock, ">&STDOUT", ">&STDERR", "/bin/cat" ); # c +an telnet to port but immediately disconnected my $pid = open3( $new_sock, $new_sock, ">&STDERR", "/bin/cat" ); # can + telnet to port but immediately disconnected waitpid( $pid, 0 ); close($sock);
In reply to IPC::Open3 not connecting network socket handle by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |