179 lines
4.5 KiB
HTML
179 lines
4.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Net::DBus::Binding::Server</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Net::DBus::Binding::Server</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-12-26<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Net::DBus::Binding::Server - A server to accept incoming connections
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
Creating a new server and accepting client connections
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
use Net::DBus::Binding::Server;
|
|
|
|
my $server = Net::DBus::Binding::Server->new(address => "unix:path=/path/to/socket");
|
|
|
|
$server->connection_callback(\&new_connection);
|
|
|
|
sub new_connection {
|
|
my $connection = shift;
|
|
|
|
.. work with new connection...
|
|
}
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
Managing the server and new connections in an event loop
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
my $reactor = Net::DBus::Binding::Reactor->new();
|
|
|
|
$reactor->manage($server);
|
|
$reactor->run();
|
|
|
|
sub new_connection {
|
|
my $connection = shift;
|
|
|
|
$reactor->manage($connection);
|
|
}
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
A server for receiving connection from client programs.
|
|
The methods defined on this module have a close
|
|
correspondence to the dbus_server_XXX methods in the C <FONT SIZE="-1">API,</FONT>
|
|
so for further details on their behaviour, the C <FONT SIZE="-1">API</FONT> documentation
|
|
may be of use.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">my $server = Net::DBus::Binding::Server->new(address => "unix:path=/path/to/socket");<DD>
|
|
|
|
|
|
|
|
|
|
Creates a new server binding it to the socket specified by the
|
|
<TT>"address"</TT> parameter.
|
|
<DT id="2">$status = $server-><B>is_connected()</B>;<DD>
|
|
|
|
|
|
|
|
|
|
Returns zero if the server has been disconnected,
|
|
otherwise a positive value is returned.
|
|
<DT id="3">$server-><B>disconnect()</B><DD>
|
|
|
|
|
|
|
|
|
|
Closes this server to the remote host. This method
|
|
is called automatically during garbage collection (ie
|
|
in the <FONT SIZE="-1">DESTROY</FONT> method) if the programmer forgets to
|
|
explicitly disconnect.
|
|
<DT id="4">$server->set_watch_callbacks(\&add_watch, \&remove_watch, \&toggle_watch);<DD>
|
|
|
|
|
|
|
|
|
|
Register a set of callbacks for adding, removing & updating
|
|
watches in the application's event loop. Each parameter
|
|
should be a code reference, which on each invocation, will be
|
|
supplied with two parameters, the server object and the
|
|
watch object. If you are using a <TT>"Net::DBus::Binding::Reactor"</TT> object
|
|
as the application event loop, then the 'manage' method on
|
|
that object will call this on your behalf.
|
|
<DT id="5">$server->set_timeout_callbacks(\&add_timeout, \&remove_timeout, \&toggle_timeout);<DD>
|
|
|
|
|
|
|
|
|
|
Register a set of callbacks for adding, removing & updating
|
|
timeouts in the application's event loop. Each parameter
|
|
should be a code reference, which on each invocation, will be
|
|
supplied with two parameters, the server object and the
|
|
timeout object. If you are using a <TT>"Net::DBus::Binding::Reactor"</TT> object
|
|
as the application event loop, then the 'manage' method on
|
|
that object will call this on your behalf.
|
|
<DT id="6">$server->set_connection_callback(\&handler)<DD>
|
|
|
|
|
|
|
|
|
|
Registers the handler to use for dealing with
|
|
new incoming connections from clients. The code
|
|
reference will be invoked each time a new client
|
|
connects and supplied with a single parameter
|
|
which is the <TT>"Net::DBus::Binding::Connection"</TT> object representing
|
|
the client.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
|
|
Daniel P. Berrange
|
|
<A NAME="lbAG"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
|
|
|
|
Copyright (C) 2004-2011 Daniel P. Berrange
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
Net::DBus::Binding::Connection, Net::DBus::Binding::Bus, Net::DBus::Binding::Message::Signal, Net::DBus::Binding::Message::MethodCall, Net::DBus::Binding::Message::MethodReturn, Net::DBus::Binding::Message::Error
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="10"><A HREF="#lbAE">METHODS</A><DD>
|
|
<DT id="11"><A HREF="#lbAF">AUTHOR</A><DD>
|
|
<DT id="12"><A HREF="#lbAG">COPYRIGHT</A><DD>
|
|
<DT id="13"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:49 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|