Last active
August 29, 2015 13:56
-
-
Save starlilyth/8943433 to your computer and use it in GitHub Desktop.
script to test cg/sgminer output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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