You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
463 B
35 lines
463 B
9 years ago
|
#!/usr/bin/perl
|
||
|
|
||
|
# sample script to query ccminer API
|
||
|
|
||
|
my $command = "summary|";
|
||
|
|
||
|
use Socket;
|
||
|
use IO::Socket::INET;
|
||
|
|
||
|
my $sock = new IO::Socket::INET (
|
||
|
PeerAddr => '127.0.0.1',
|
||
|
PeerPort => 4068,
|
||
|
Proto => 'tcp',
|
||
|
ReuseAddr => 1,
|
||
|
Timeout => 10,
|
||
|
);
|
||
|
|
||
|
if ($sock) {
|
||
|
|
||
|
print $sock $command;
|
||
|
my $res = "";
|
||
|
|
||
|
while(<$sock>) {
|
||
|
$res .= $_;
|
||
|
}
|
||
|
|
||
|
close($sock);
|
||
|
print("$res\n");
|
||
|
|
||
|
} else {
|
||
|
|
||
|
print("ccminer socket failed\n");
|
||
|
|
||
|
}
|