Skip to content

Commit

Permalink
api: sample command line api call in perl
Browse files Browse the repository at this point in the history
tx to lilyth for the idea (works on cpuminer, sgminer and cgminer too)
  • Loading branch information
tpruvot committed May 31, 2016
1 parent a7905e6 commit f85e377
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api/summary.pl
@@ -0,0 +1,34 @@
#!/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");

}

0 comments on commit f85e377

Please sign in to comment.