NAME

Net::UNIX::Server - UNIX-domain sockets interface module for listeners

SYNOPSIS

use Net::Gen;		# optional
use Net::UNIX;		# optional
use Net::UNIX::Server;

DESCRIPTION

The Net::UNIX::Server module provides additional services for UNIX-domain socket communication. It is layered atop the Net::UNIX and Net::Gen modules, which are part of the same distribution.

Public Methods

The following methods are provided by the Net::UNIX::Server module itself, rather than just being inherited from Net::UNIX or Net::Gen.

new

Usage:

$obj = new Net::UNIX::Server;
$obj = new Net::UNIX::Server $pathname;
$obj = new Net::UNIX::Server $pathname, \%parameters;
$obj = 'Net::UNIX::Server'->new();
$obj = 'Net::UNIX::Server'->new($pathname);
$obj = 'Net::UNIX::Server'->new($pathname, \%parameters);

Returns a newly-initialised object of the given class. This is much like the regular new methods of other modules in this distribution, except that it does a bind rather than a connect, and it does a listen. Unless specified otherwise with a type object parameter, the underlying socket will be a datagram socket (SOCK_DGRAM).

The examples above show the indirect object syntax which many prefer, as well as the guaranteed-to-be-safe static method call. There are occasional problems with the indirect object syntax, which tend to be rather obscure when encountered. See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1998-01/msg01674.html for details.

See Net::TCP::Server for an example of running a server. The differences are only in the module names and the fact that UNIX-domain sockets bind to a pathname rather than to a port number. Of course, that example is for stream (type = SOCK_STREAM) sockets rather than for datagrams. UNIX-domain datagram sockets don't need to do an accept() (and can't where I've tested this code), and can't answer back to their clients unless those clients have also bound to a specific path name.

init

Usage:

return undef unless $self = $self->init;
return undef unless $self = $self->init(\%parameters);
return undef unless $self = $self->init($pathname);
return undef unless $self = $self->init($pathname, \%parameters);

Verifies that all previous parameter assignments are valid (via checkparams). Returns the incoming object on success, and undef on failure. Usually called only via a derived class's init method or its own new call.

Protected Methods

[See the description in "Protected Methods" in Net::Gen for my definition of protected methods in Perl.]

None.

Known Socket Options

There are no socket options known to the Net::UNIX::Server module itself.

Known Object Parameters

There are no object parameters registered by the Net::UNIX::Server module itself.

Exports

default

None.

exportable

None.

tags

The following :tags are available for grouping exportable items:

:ALL

All of the above exportable items.

THREADING STATUS

This module has been tested with threaded perls, and should be as thread-safe as perl itself. (As of 5.005_03 and 5.005_57, that's not all that safe just yet.) It also works with interpreter-based threads ('ithreads') in more recent perl releases.

SEE ALSO

Net::UNIX(3), Net::Gen(3)

AUTHOR

Spider Boardman <spidb@cpan.org>