man-pages/man3/Net::DBus::Binding::Server.3pm.html
2021-03-31 01:06:50 +01:00

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">&nbsp;</A>
<H2>NAME</H2>
Net::DBus::Binding::Server - A server to accept incoming connections
<A NAME="lbAC">&nbsp;</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-&gt;new(address =&gt; &quot;unix:path=/path/to/socket&quot;);
$server-&gt;connection_callback(\&amp;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-&gt;new();
$reactor-&gt;manage($server);
$reactor-&gt;run();
sub new_connection {
my $connection = shift;
$reactor-&gt;manage($connection);
}
</PRE>
<A NAME="lbAD">&nbsp;</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">&nbsp;</A>
<H2>METHODS</H2>
<DL COMPACT>
<DT id="1">my $server = Net::DBus::Binding::Server-&gt;new(address =&gt; &quot;unix:path=/path/to/socket&quot;);<DD>
Creates a new server binding it to the socket specified by the
<TT>&quot;address&quot;</TT> parameter.
<DT id="2">$status = $server-&gt;<B>is_connected()</B>;<DD>
Returns zero if the server has been disconnected,
otherwise a positive value is returned.
<DT id="3">$server-&gt;<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-&gt;set_watch_callbacks(\&amp;add_watch, \&amp;remove_watch, \&amp;toggle_watch);<DD>
Register a set of callbacks for adding, removing &amp; 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>&quot;Net::DBus::Binding::Reactor&quot;</TT> object
as the application event loop, then the 'manage' method on
that object will call this on your behalf.
<DT id="5">$server-&gt;set_timeout_callbacks(\&amp;add_timeout, \&amp;remove_timeout, \&amp;toggle_timeout);<DD>
Register a set of callbacks for adding, removing &amp; 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>&quot;Net::DBus::Binding::Reactor&quot;</TT> object
as the application event loop, then the 'manage' method on
that object will call this on your behalf.
<DT id="6">$server-&gt;set_connection_callback(\&amp;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>&quot;Net::DBus::Binding::Connection&quot;</TT> object representing
the client.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>AUTHOR</H2>
Daniel P. Berrange
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (C) 2004-2011 Daniel P. Berrange
<A NAME="lbAH">&nbsp;</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">&nbsp;</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>