Skip to content

Instantly share code, notes, and snippets.

@starlilyth
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starlilyth/8943433 to your computer and use it in GitHub Desktop.
Save starlilyth/8943433 to your computer and use it in GitHub Desktop.
script to test cg/sgminer output
#!/usr/bin/perl
# script to test cg/sgminer API output
my $command = "summary|";
use Socket;
use IO::Socket::INET;
my $sock = new IO::Socket::INET (
PeerAddr => '127.0.0.1',
PeerPort => 4028,
Proto => 'tcp',
ReuseAddr => 1,
Timeout => 10,
);
if ($sock) {
print $sock $command;
my $res = "";
while(<$sock>) {
$res .= $_;
}
close($sock);
print $res;
} else {
print "cgminer socket failed";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment