1
0
mirror of https://github.com/GOSTSec/ccminer synced 2025-01-08 22:07:56 +00:00
ccminer/api/summary.pl
Tanguy Pruvot f85e3772f9 api: sample command line api call in perl
tx to lilyth for the idea (works on cpuminer, sgminer and cgminer too)
2016-05-31 19:20:58 +02:00

35 lines
463 B
Raku
Executable File

#!/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");
}