line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RMI::Client::Tcp; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
4600
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
196
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
228
|
|
5
|
|
|
|
|
|
|
our $VERSION = $RMI::VERSION; |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
20
|
use base 'RMI::Client'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1710
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
3612
|
use IO::Socket; |
|
4
|
|
|
|
|
114292
|
|
|
4
|
|
|
|
|
38
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
RMI::Node::_mk_ro_accessors(__PACKAGE__, qw/host port/); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $DEFAULT_HOST = "127.0.0.1"; |
14
|
|
|
|
|
|
|
our $DEFAULT_PORT = 4409; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
2
|
|
|
2
|
1
|
1003763
|
my $class = shift; |
18
|
2
|
|
|
|
|
248
|
my $self = $class->SUPER::new( |
19
|
|
|
|
|
|
|
host => $DEFAULT_HOST, |
20
|
|
|
|
|
|
|
port => $DEFAULT_PORT, |
21
|
|
|
|
|
|
|
reader => 1, # replaced below |
22
|
|
|
|
|
|
|
writer => 1, # replaced below |
23
|
|
|
|
|
|
|
@_ |
24
|
|
|
|
|
|
|
); |
25
|
2
|
50
|
|
|
|
36
|
return unless $self; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
22
|
my $socket = IO::Socket::INET->new( |
28
|
|
|
|
|
|
|
PeerHost => $self->host, |
29
|
|
|
|
|
|
|
PeerPort => $self->port, |
30
|
|
|
|
|
|
|
ReuseAddr => 1, |
31
|
|
|
|
|
|
|
#ReusePort => 1, |
32
|
|
|
|
|
|
|
); |
33
|
2
|
50
|
|
|
|
3680
|
unless ($socket) { |
34
|
0
|
|
|
|
|
0
|
my $msg = sprintf( |
35
|
|
|
|
|
|
|
"Error connecting to remote host %s on port %s : $!", |
36
|
|
|
|
|
|
|
$self->host, |
37
|
|
|
|
|
|
|
$self->port |
38
|
|
|
|
|
|
|
); |
39
|
0
|
|
|
|
|
0
|
$self = undef; |
40
|
0
|
|
|
|
|
0
|
die $msg; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
|
|
9
|
$self->{reader} = $socket; |
44
|
2
|
|
|
|
|
5
|
$self->{writer} = $socket; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
10
|
return $self; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
RMI::Client::Tcp - an RMI::Client implementation using TCP/IP sockets |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This document describes RMI::Client::Tcp v0.10. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SYNOPSIS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$c = RMI::Client::Tcp->new( |
64
|
|
|
|
|
|
|
host => 'myserver.com', # defaults to 'localhost' |
65
|
|
|
|
|
|
|
port => 1234 # defaults to 4409 |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$c->call_use('IO::File'); |
69
|
|
|
|
|
|
|
$remote_fh = $c->call_class_method('IO::File', 'new', '/my/file'); |
70
|
|
|
|
|
|
|
print <$remote_fh>; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This subclass of RMI::Client makes a TCP/IP socket connection to an |
75
|
|
|
|
|
|
|
B. See B for details on the general client |
76
|
|
|
|
|
|
|
API. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
See for B for details on how to start a matching |
79
|
|
|
|
|
|
|
B. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
See the general B description for an overview of how RMI::Client and |
82
|
|
|
|
|
|
|
RMI::Servers interact, and examples. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 METHODS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This class overrides the constructor for a default RMI::Client to make a |
87
|
|
|
|
|
|
|
socket connection. That socket is both the reader and writer handle for the |
88
|
|
|
|
|
|
|
client. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 BUGS AND CAVEATS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
See general bugs in B for general system limitations of proxied objects. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SEE ALSO |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
B, B, B, B, B, B |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|