HP StorageWorks Replication Solutions Manager Command Line User Interface Reference (T3687-96029, August 2005)

$sock->print($cmd . "\r\n");
$line = readResponse();
print("$line\n");
#close our socket
$sock->close();
#exit success if we make it here
exit 0;
#
sub getResponse{
#WARNING - this will block if line is not available
my $ret = "";
$ret = readline $sock;
return $ret;
}
#sub to find the </commandresponse> string that is found
#after setting result type to xml
sub readResponse {
my $resp = "";
my $buff = '';
$line = "";
while(index($resp, "</commandresponse>") < 0){
recv($sock, $buff, 1024, 0);
$line = unpack("a1024", $buff);
$resp = $resp . $line;
#print("$line\n");
}
return $resp;
}
sub usage {
print "\n\n\*************************************************************************\n\n";
print "Use: clui_socket_config_retrieval.pl <host> <port> <username> <password> <command>\n\n"
;
print " host - ip or name\n";
print " port - the port the clui is on\n";
print " username - admin user name\n";
print " password - admin password\n";
print " command - The command to send to the server (in quotes)\n\n";
print "*************************************************************************\n";
} # end sub usage
Sample SSL client
using Perl
# a test client for testing CLUI Result Code Retrieval
#
use strict;
use IO::Socket::SSL;
my ($hostname, $line, $passwd, $username, $res, $sock, $port, $cmd);
if(@ARGV < 5){
usage();
die "\nincorrect number of arguments\n\n";
}
$hostname = $ARGV[0];
HP StorageWorks Replication Solutions Manager Command Line User Interface reference
47