The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
=encoding utf8

=head1 NAME

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

=head1 INHERITANCE

 IOMux::Service::TCP
   is a IOMux::Handler::Service
   is a IOMux::Handler

 IOMux::Service::TCP is extended by
   IOMux::HTTP::Gateway
   IOMux::HTTP::Server

=head1 SYNOPSIS

  my $service = IOMux::Service::TCP->new
    ( # capitalized 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
    );

=head1 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 L<"DESCRIPTION" in IOMux::Handler::Service|IOMux::Handler::Service/"DESCRIPTION">.
 
=head1 METHODS

Extends L<"METHODS" in IOMux::Handler::Service|IOMux::Handler::Service/"METHODS">.
 
=head2 Constructors

Extends L<"Constructors" in IOMux::Handler::Service|IOMux::Handler::Service/"Constructors">.
 
=over 4

=item IOMux::Service::TCP-E<gt>B<new>(%options)

 -Option   --Defined in     --Default
  conn_opts                   []
  conn_type                   <required>
  fh         IOMux::Handler   <required>
  name       IOMux::Handler   'listen tcp $host:$port'

=over 2

=item conn_opts => ARRAY

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

=item conn_type => CLASS|CODE

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

=item fh => FILEHANDLE

=item name => STRING

=back

=item IOMux::Service::TCP-E<gt>B<open>($mode, $what, %options)

Inherited, see L<IOMux::Handler/"Constructors">

=back

=head2 Accessors

Extends L<"Accessors" in IOMux::Handler::Service|IOMux::Handler::Service/"Accessors">.
 
=over 4

=item $obj-E<gt>B<clientType>()

=item $obj-E<gt>B<fh>()

Inherited, see L<IOMux::Handler/"Accessors">

=item $obj-E<gt>B<fileno>()

Inherited, see L<IOMux::Handler/"Accessors">

=item $obj-E<gt>B<mux>()

Inherited, see L<IOMux::Handler/"Accessors">

=item $obj-E<gt>B<name>()

Inherited, see L<IOMux::Handler/"Accessors">

=item $obj-E<gt>B<socket>()

=item $obj-E<gt>B<usesSSL>()

Inherited, see L<IOMux::Handler/"Accessors">

=back

=head2 User interface

Extends L<"User interface" in IOMux::Handler::Service|IOMux::Handler::Service/"User interface">.
 
=head2 Multiplexer

Extends L<"Multiplexer" in IOMux::Handler::Service|IOMux::Handler::Service/"Multiplexer">.
 
=head2 Helpers

Extends L<"Helpers" in IOMux::Handler::Service|IOMux::Handler::Service/"Helpers">.
 
=over 4

=item $obj-E<gt>B<extractSocket>(HASH)

=item IOMux::Service::TCP-E<gt>B<extractSocket>(HASH)

Inherited, see L<IOMux::Handler/"Helpers">

=item $obj-E<gt>B<fdset>($state, $read, $write, $error)

Inherited, see L<IOMux::Handler/"Helpers">

=item $obj-E<gt>B<show>()

Inherited, see L<IOMux::Handler/"Helpers">

=back

=head1 SEE ALSO

This module is part of IOMux distribution version 1.00,
built on November 11, 2015. Website: F<http://perl.overmeer.net/>
All modules in this suite:
L</Any::Daemon>,
L</IOMux>, and
L</IOMux::HTTP>.

Please post questions or ideas to F<perl@overmeer.net>

=head1 LICENSE

Copyrights 2011-2015 by [Mark Overmeer]. 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 F<http://www.perl.com/perl/misc/Artistic.html>