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

Comparing Coro/Event/Socket.pm (file contents):
Revision 1.4 by root, Wed Sep 12 16:45:59 2001 UTC vs.
Revision 1.5 by root, Fri Sep 14 15:40:56 2001 UTC

150 150
151 $fh; 151 $fh;
152} 152}
153 153
154=item connect, listen, bind, getsockopt, setsockopt, 154=item connect, listen, bind, getsockopt, setsockopt,
155send, recv, getpeername, getsockname 155send, recv, peername, sockname
156 156
157Do the same thing as the perl builtins (but return true on 157Do the same thing as the perl builtins or IO::Socket methods (but return
158EINPROGRESS). Remember that these must be method calls. 158true on EINPROGRESS). Remember that these must be method calls.
159 159
160=cut 160=cut
161 161
162sub connect { connect tied(${$_[0]})->[0], $_[1] or $! == Errno::EINPROGRESS } 162sub connect { connect tied(${$_[0]})->[0], $_[1] or $! == Errno::EINPROGRESS }
163sub bind { bind tied(${$_[0]})->[0], $_[1] } 163sub bind { bind tied(${$_[0]})->[0], $_[1] }
164sub listen { listen tied(${$_[0]})->[0], $_[1] } 164sub listen { listen tied(${$_[0]})->[0], $_[1] }
165sub getsockopt { getsockopt tied(${$_[0]})->[0], $_[1], $_[2] } 165sub getsockopt { getsockopt tied(${$_[0]})->[0], $_[1], $_[2] }
166sub setsockopt { setsockopt tied(${$_[0]})->[0], $_[1], $_[2], $_[3] } 166sub setsockopt { setsockopt tied(${$_[0]})->[0], $_[1], $_[2], $_[3] }
167sub send { send tied(${$_[0]})->[0], $_[1], $_[2], @_ > 2 ? $_[3] : () } 167sub send { send tied(${$_[0]})->[0], $_[1], $_[2], @_ > 2 ? $_[3] : () }
168sub recv { recv tied(${$_[0]})->[0], $_[1], $_[2], @_ > 2 ? $_[3] : () } 168sub recv { recv tied(${$_[0]})->[0], $_[1], $_[2], @_ > 2 ? $_[3] : () }
169sub sockname { getsockname tied(${$_[0]})->[0] }
169sub getsockname { getsockname tied(${$_[0]})->[0] } 170sub peername { getpeername tied(${$_[0]})->[0] }
170sub getpeername { getpeername tied(${$_[0]})->[0] }
171 171
172=item ($peername, $fh) = $listen_fh->accept 172=item ($peername, $fh) = $listen_fh->accept
173 173
174In scalar context, returns the newly accepted socket (or undef) and in 174In scalar context, returns the newly accepted socket (or undef) and in
175list context return the ($fh, $peername) pair (or nothing). 175list context return the ($fh, $peername) pair (or nothing).
179sub accept { 179sub accept {
180 my ($peername, $fh); 180 my ($peername, $fh);
181 while () { 181 while () {
182 $peername = accept $fh, tied(${$_[0]})->[0] 182 $peername = accept $fh, tied(${$_[0]})->[0]
183 and return wantarray 183 and return wantarray
184 ? ((new_from_fh Coro::Socket $fh), $peername), 184 ? ((new_from_fh Coro::Socket $fh), $peername)
185 : (new_from_fh Coro::Socket $fh); 185 : (new_from_fh Coro::Socket $fh);
186 186
187 return unless $!{EAGAIN}; 187 return unless $!{EAGAIN};
188 188
189 $_[0]->readable or return; 189 $_[0]->readable or return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines