/[cvs]/nfo/perl/scripts/giantdisc/bin/gdclient.pm
ViewVC logotype

Contents of /nfo/perl/scripts/giantdisc/bin/gdclient.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Tue Mar 8 16:00:57 2005 UTC (19 years, 4 months ago) by joko
Branch: MAIN
+ initial commit

1 package gdclient;
2
3 use strict;
4 use warnings;
5
6 require Exporter;
7 use IO::Socket;
8 use Data::Dumper;
9
10 our @ISA = qw( Exporter );
11 our @EXPORT = qw( gd_connect gd_disconnect gd_command );
12
13
14 my $sock;
15
16 sub gd_connect {
17 my $host = shift;
18 my $port = shift;
19
20 $host ||= `hostname -i`;
21 $port ||= 26468;
22 $sock = IO::Socket::INET->new(PeerAddr => $host,
23 PeerPort => $port,
24 Proto => 'tcp') or die($@);
25 }
26
27 sub gd_disconnect {
28 $sock->close();
29 }
30
31 sub gd_command {
32 my $cmd = shift;
33 my @args = @_;
34
35 $sock->send(join("\t", $cmd, @args) . "\n");
36 }
37
38 #my $data;
39 #$sock->read(1024,$data) until $sock->atmark;
40
41
42 ###############################################################################
43 1;

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed