in reply to Re: Communicate with child process via stdin, stdout
in thread Communicate with child process via stdin, stdout
#! /usr/bin/perl use warnings; use strict; use IPC::Open2; my $pid = open2 my $out, my $in, "/usr/pluto/bin/DCE-Whisperer -d 38 - +r 192.168.0.51"; die "$0: open2: $!" unless defined $pid; #print $in "PING"; my $sum=undef; while (1) { $sum = <$out>; if ($sum) { print ("Got from DCERouter(out): $sum\n") ; print $in "reply txt OK\n"; $sum=undef; }; } ; close $in or warn "$0: close: $!"; close $out or warn "$0: close: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Communicate with child process via stdin, stdout
by quester (Vicar) on Nov 20, 2011 at 06:41 UTC |