1Net::DBus::Binding::SerUvseerr(3C)ontributed Perl DocumeNnetta:t:iDoBnus::Binding::Server(3)
2
3
4

NAME

6       Net::DBus::Binding::Server - A server to accept incoming connections
7

SYNOPSIS

9       Creating a new server and accepting client connections
10
11         use Net::DBus::Binding::Server;
12
13         my $server = Net::DBus::Binding::Server->new(address => "unix:path=/path/to/socket");
14
15         $server->connection_callback(\&new_connection);
16
17         sub new_connection {
18             my $connection = shift;
19
20             .. work with new connection...
21         }
22
23       Managing the server and new connections in an event loop
24
25         my $reactor = Net::DBus::Binding::Reactor->new();
26
27         $reactor->manage($server);
28         $reactor->run();
29
30         sub new_connection {
31             my $connection = shift;
32
33             $reactor->manage($connection);
34         }
35

DESCRIPTION

37       A server for receiving connection from client programs.  The methods
38       defined on this module have a close correspondence to the
39       dbus_server_XXX methods in the C API, so for further details on their
40       behaviour, the C API documentation may be of use.
41

METHODS

43       my $server = Net::DBus::Binding::Server->new(address =>
44       "unix:path=/path/to/socket");
45           Creates a new server binding it to the socket specified by the
46           "address" parameter.
47
48       $status = $server->is_connected();
49           Returns zero if the server has been disconnected, otherwise a
50           positive value is returned.
51
52       $server->disconnect()
53           Closes this server to the remote host. This method is called
54           automatically during garbage collection (ie in the DESTROY method)
55           if the programmer forgets to explicitly disconnect.
56
57       $server->set_watch_callbacks(\&add_watch, \&remove_watch,
58       \&toggle_watch);
59           Register a set of callbacks for adding, removing & updating watches
60           in the application's event loop. Each parameter should be a code
61           reference, which on each invocation, will be supplied with two
62           parameters, the server object and the watch object. If you are
63           using a "Net::DBus::Binding::Reactor" object as the application
64           event loop, then the 'manage' method on that object will call this
65           on your behalf.
66
67       $server->set_timeout_callbacks(\&add_timeout, \&remove_timeout,
68       \&toggle_timeout);
69           Register a set of callbacks for adding, removing & updating
70           timeouts in the application's event loop. Each parameter should be
71           a code reference, which on each invocation, will be supplied with
72           two parameters, the server object and the timeout object. If you
73           are using a "Net::DBus::Binding::Reactor" object as the application
74           event loop, then the 'manage' method on that object will call this
75           on your behalf.
76
77       $server->set_connection_callback(\&handler)
78           Registers the handler to use for dealing with new incoming
79           connections from clients. The code reference will be invoked each
80           time a new client connects and supplied with a single parameter
81           which is the "Net::DBus::Binding::Connection" object representing
82           the client.
83

AUTHOR

85       Daniel P. Berrange
86
88       Copyright (C) 2004-2011 Daniel P. Berrange
89

SEE ALSO

91       Net::DBus::Binding::Connection, Net::DBus::Binding::Bus,
92       Net::DBus::Binding::Message::Signal,
93       Net::DBus::Binding::Message::MethodCall,
94       Net::DBus::Binding::Message::MethodReturn,
95       Net::DBus::Binding::Message::Error
96
97
98
99perl v5.32.1                      2021-01-27     Net::DBus::Binding::Server(3)
Impressum