#!/usr/bin/perl -w

use strict;
use Shout;

# start the connection
my $conn = new Shout;

# setup all the params
$conn->ip('localhost');
$conn->port(8000);
$conn->mount('testing');
$conn->password('pa$$w0rd');
$conn->ispublic(0);

# try to connect
if ($conn->connect) {
    print "connected...\n";

    # if we connect, grab data from stdin and shoot it to the server
    my ($buff, $len);
    while (($len = sysread(STDIN, $buff, 4096)) > 0) {
	unless ($conn->sendData($buff)) {
	    print "Error while sending: " . $conn->error . "\n";
	    last;
	}
	
	# must be careful not to send the data too fast :)
	$conn->sleep;
    }

    # all done
    $conn->disconnect;
} else {
    print "couldn't connect...\n";
}


