From: Adrian S. <a3s...@us...> - 2005-07-26 19:19:35
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14363 Modified Files: wbemcat Log Message: Fixed [ 1242514 ] wbemcat fails under SuSE nc program not needed anymore. Its function is replaced by a few Perl stmts. Index: wbemcat =================================================================== RCS file: /cvsroot/sblim/sfcb/wbemcat,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- wbemcat 7 Jun 2005 20:01:52 -0000 1.6 +++ wbemcat 26 Jul 2005 19:19:26 -0000 1.7 @@ -21,6 +21,7 @@ use strict; use Getopt::Long; +use IO::Socket; # Defaults my $port = 5988; @@ -72,11 +73,24 @@ # Pipe STDOUT to nc command # DEBUG: Comment out this line to see what data gets sent to the CIMOM -open(STDOUT, "| nc $host $port") || die "Cannot fork nc command: $!"; -# Send preamble and XML data to CIMOM via STDOUT pipe -print @preamble; -print @xml; +# nc not supported on all distributions +# open(STDOUT, "| nc $host $port") || die "Cannot fork nc command: $!"; -close(STDOUT) || warn "Cannot close STDOUT"; +my ($socket, $answer,$n); +$socket=IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port, + Proto => "tcp", Type => SOCK_STREAM) + or die "Could not connect to $host:$port : $@\n"; +# Send preamble and XML data to CIMOM via STDOUT pipe +print $socket @preamble; +print $socket @xml; + +# Get the answer +$answer = ""; +while (defined ($answer = <$socket>)) { + print ">$answer<"; +} +#print $answer; + +close($socket); |