summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/ghosd/osdClient.pl
blob: 06fc381fff9cf27daf87d7d22827c2b658257a5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -w
# osdClient.pl - send simple client text to server

use strict;
use IO::Socket::INET;
use POSIX qw(F_GETFL F_SETFL O_NONBLOCK);
my $sock = "";

if( $#ARGV != 2 ){ die "specify a ip, port, text string" }

eval
{
  $sock = IO::Socket::INET->new( 
    PeerAddr => $ARGV[0],
    PeerPort => $ARGV[1]) || die "can't set it up $!";

  $sock->blocking(0)
};

if( $@ =~ /socket/i )
{
  print "die in record retrieval socket setup with $@";
}

print $sock "$ARGV[2] \n";