++ed by:
POTATOGIM JEFFOBER KOVENSKY SHARYANTO PJF

26 PAUSE users
26 non-PAUSE users.

Marc A. Lehmann

NAME

Coro::Socket - non-blocking socket-io

SYNOPSIS

 use Coro::Socket;

 # listen on an ipv4 socket
 my $socket = new Coro::Socket PeerHost => "localhost",
                               PeerPort => 'finger';

 # listen on any other type of socket
 my $socket = Coro::Socket->new_from_fh
                 (IO::Socket::UNIX->new
                     Local  => "/tmp/socket",
                     Type   => SOCK_STREAM,
                 );

DESCRIPTION

This module implements socket-handles in a coroutine-compatible way, that is, other coroutines can run while reads or writes block on the handle. See Coro::Handle, especially the note about prefering method calls.

$fh = new Coro::Socket param => value, ...

Create a new non-blocking tcp handle and connect to the given host and port. The parameter names and values are mostly the same as in IO::Socket::INET (as ugly as I think they are).

If the host is unreachable or otherwise cannot be connected to this method returns undef. On all other errors ot croak's.

Multihomed is always enabled.

   $fh = new Coro::Socket PeerHost => "localhost", PeerPort => 'finger';

AUTHOR

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/