NAME

IOMux::Service::TCP - TCP (socket) based service

INHERITANCE

IOMux::Service::TCP
  is an IOMux::Handler::Service
  is an IOMux::Handler

SYNOPSIS

my $service = IOMux::Service::TCP->new
  ( # capitalized params are passed to the socket constructor
    Host   => 'localhost:8080'
  , Listen => 3

    # object to initialize when new connection arrives
  , conn_type => $conn_handler_class  # extends IOMux::Net::TCP
  , conn_opts => \@conn_handler_init_params
  );

DESCRIPTION

Accept TCP connections. When a connection arrives, it will get handled by a new object which gets added to the multiplexer as well.

Extends "DESCRIPTION" in IOMux::Handler::Service.

METHODS

Extends "METHODS" in IOMux::Handler::Service.

Constructors

Extends "Constructors" in IOMux::Handler::Service.

IOMux::Service::TCP->new(%options)
-Option   --Defined in     --Default
 conn_opts                   []
 conn_type                   <required>
 fh         IOMux::Handler   <required>
 hostname                    <sockhost:sockport>
 name       IOMux::Handler   'listen tcp $host:$port'
 socket                      <created from capitalized parameters>
conn_opts => ARRAY

Pass some extra options when objects of conn_type are created, passed as list of pairs.

conn_type => CLASS|CODE

The CLASS (package name) of client to be created for each new contact. This CLASS must extend IOMux::Net::TCP. You may also provide a CODE reference which will be called with the socket leading to the client.

fh => FILEHANDLE
hostname => URI

How this socket gan be addressed from remote, for instance as virtual host for HTTP.

name => STRING
socket => IO::Socket::INET object
IOMux::Service::TCP->open($mode, $what, %options)

Inherited, see "Constructors" in IOMux::Handler

Accessors

Extends "Accessors" in IOMux::Handler::Service.

$obj->clientType()
$obj->fh()

Inherited, see "Accessors" in IOMux::Handler

$obj->fileno()

Inherited, see "Accessors" in IOMux::Handler

$obj->hostname()
$obj->mux()

Inherited, see "Accessors" in IOMux::Handler

$obj->name()

Inherited, see "Accessors" in IOMux::Handler

$obj->socket()
$obj->usesSSL()

Inherited, see "Accessors" in IOMux::Handler

User interface

Extends "User interface" in IOMux::Handler::Service.

Multiplexer

Extends "Multiplexer" in IOMux::Handler::Service.

Connection

Extends "Connection" in IOMux::Handler::Service.

$obj->muxInit( $mux, [$handler] )

Inherited, see "Connection" in IOMux::Handler

$obj->muxRemove()

Inherited, see "Connection" in IOMux::Handler

$obj->muxTimeout()

Inherited, see "Connection" in IOMux::Handler

Reading

Extends "Reading" in IOMux::Handler::Service.

$obj->muxExceptFlagged($fileno)

Inherited, see "Reading" in IOMux::Handler

$obj->muxReadFlagged()

Writing

Extends "Writing" in IOMux::Handler::Service.

$obj->muxWriteFlagged($fileno)

Inherited, see "Writing" in IOMux::Handler

Service

Extends "Service" in IOMux::Handler::Service.

$obj->muxConnection($client)

Inherited, see "Service" in IOMux::Handler::Service

Helpers

Extends "Helpers" in IOMux::Handler::Service.

$obj->extractSocket(HASH)
IOMux::Service::TCP->extractSocket(HASH)

Inherited, see "Helpers" in IOMux::Handler

$obj->fdset($state, $read, $write, $error)

Inherited, see "Helpers" in IOMux::Handler

$obj->show()

Inherited, see "Helpers" in IOMux::Handler

DIAGNOSTICS

Error: $pkg needs STREAM protocol socket
Error: a conn_type for incoming request is need by $name
Error: accept for socket $name failed

SEE ALSO

This module is part of IOMux distribution version 1.01, built on January 15, 2020. Website: http://perl.overmeer.net/CPAN

LICENSE

Copyrights 2011-2020 by [Mark Overmeer <[email protected]>]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/