ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Socket.pm
(Generate patch)

Comparing Coro/Coro/Socket.pm (file contents):
Revision 1.47 by root, Mon Mar 16 22:22:12 2009 UTC vs.
Revision 1.48 by root, Mon Apr 6 03:34:21 2009 UTC

89Create a new non-blocking tcp handle and connect to the given host 89Create a new non-blocking tcp handle and connect to the given host
90and port. The parameter names and values are mostly the same as for 90and port. The parameter names and values are mostly the same as for
91IO::Socket::INET (as ugly as I think they are). 91IO::Socket::INET (as ugly as I think they are).
92 92
93The parameters officially supported currently are: C<ReuseAddr>, 93The parameters officially supported currently are: C<ReuseAddr>,
94C<LocalPort>, C<LocalHost>, C<PeerPort>, C<PeerHost>, C<Listen>, C<Timeout>. 94C<LocalPort>, C<LocalHost>, C<PeerPort>, C<PeerHost>, C<Listen>, C<Timeout>,
95C<SO_RCVBUF>, C<SO_SNDBUF>.
95 96
96 $fh = new Coro::Socket PeerHost => "localhost", PeerPort => 'finger'; 97 $fh = new Coro::Socket PeerHost => "localhost", PeerPort => 'finger';
97 98
98=cut 99=cut
99 100
141 if ($arg->{Broadcast}) { 142 if ($arg->{Broadcast}) {
142 $self->setsockopt (SOL_SOCKET, SO_BROADCAST, 1) 143 $self->setsockopt (SOL_SOCKET, SO_BROADCAST, 1)
143 or croak "setsockopt(SO_BROADCAST): $!"; 144 or croak "setsockopt(SO_BROADCAST): $!";
144 } 145 }
145 146
147 if ($arg->{SO_RCVBUF}) {
148 $self->setsockopt (SOL_SOCKET, SO_RCVBUF, $arg->{SO_RCVBUF})
149 or croak "setsockopt(SO_RCVBUF): $!";
150 }
151
152 if ($arg->{SO_SNDBUF}) {
153 $self->setsockopt (SOL_SOCKET, SO_SNDBUF, $arg->{SO_SNDBUF})
154 or croak "setsockopt(SO_SNDBUF): $!";
155 }
156
146 if ($arg->{LocalPort} || $arg->{LocalHost}) { 157 if ($arg->{LocalPort} || $arg->{LocalHost}) {
147 my @sa = _sa($arg->{LocalHost} || "0.0.0.0", $arg->{LocalPort} || 0, $arg->{Proto}); 158 my @sa = _sa($arg->{LocalHost} || "0.0.0.0", $arg->{LocalPort} || 0, $arg->{Proto});
148 $self->bind ($sa[0]) 159 $self->bind ($sa[0])
149 or croak "bind($arg->{LocalHost}:$arg->{LocalPort}): $!"; 160 or croak "bind($arg->{LocalHost}:$arg->{LocalPort}): $!";
150 } 161 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines