ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Handle.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Handle.pm (file contents):
Revision 1.193 by root, Mon Mar 15 18:51:30 2010 UTC vs.
Revision 1.194 by root, Thu May 20 21:22:21 2010 UTC

1=head1 NAME 1=head1 NAME
2 2
3AnyEvent::Handle - non-blocking I/O on file handles via AnyEvent 3AnyEvent::Handle - non-blocking I/O on streaming handles via AnyEvent
4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use AnyEvent; 7 use AnyEvent;
8 use AnyEvent::Handle; 8 use AnyEvent::Handle;
31 $cv->recv; 31 $cv->recv;
32 32
33=head1 DESCRIPTION 33=head1 DESCRIPTION
34 34
35This module is a helper module to make it easier to do event-based I/O on 35This module is a helper module to make it easier to do event-based I/O on
36filehandles. 36stream-based filehandles (sockets, pipes or other stream things).
37 37
38The L<AnyEvent::Intro> tutorial contains some well-documented 38The L<AnyEvent::Intro> tutorial contains some well-documented
39AnyEvent::Handle examples. 39AnyEvent::Handle examples.
40 40
41In the following, when the documentation refers to of "bytes" then this 41In the following, when the documentation refers to of "bytes" then this
531 $self 531 $self
532} 532}
533 533
534sub _start { 534sub _start {
535 my ($self) = @_; 535 my ($self) = @_;
536
537 # too many clueless people try to use udp and similar sockets
538 # with AnyEvent::Handle, do them a favour.
539 if (Socket::SOCK_STREAM != unpack "I", getsockopt $self->{fh}, Socket::SOL_SOCKET (), Socket::SO_TYPE ()) {
540 Carp::croak "AnyEvent::Handle: only stream sockets supported, anything else will NOT work!";
541 }
536 542
537 AnyEvent::Util::fh_nonblocking $self->{fh}, 1; 543 AnyEvent::Util::fh_nonblocking $self->{fh}, 1;
538 544
539 $self->{_activity} = 545 $self->{_activity} =
540 $self->{_ractivity} = 546 $self->{_ractivity} =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines