/usr/share/doc/libdbus-java/dbus-java/dbus-javase12.html is in libdbus-java-doc 2.8-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | <?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head><title>Peer to Peer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,2,html -->
<meta name="src" content="dbus-java.tex" />
<meta name="date" content="2014-02-01 05:14:00" />
<link rel="stylesheet" type="text/css" href="dbus-java.css" />
</head><body
>
<!--l. 921--><div class="crosslinks"><p class="noindent">[<a
href="dbus-javase11.html" >prev</a>] [<a
href="dbus-javase11.html#taildbus-javase11.html" >prev-tail</a>] [<a
href="#taildbus-javase12.html">tail</a>] [<a
href="dbus-java.html# " >up</a>] </p></div>
<h3 class="sectionHead"><span class="titlemark">12 </span> <a
id="x36-3800012"></a>Peer to Peer</h3>
<!--l. 923--><p class="noindent" >It is possible to connect two applications together directly without using a bus. D-Bus calls this
a peer-to-peer connection.
</p><!--l. 926--><p class="indent" > The Java implementation provides an alternative to the <span
class="cmtt-12">DBusConnection </span>class, the
<span
class="cmtt-12">DirectConnection</span><span class="footnote-mark"><a
href="dbus-java37.html#fn21x0"><sup class="textsuperscript">21</sup></a></span><a
id="x36-38001f21"></a>
class. This allows you to connect two applications together directly without the need of a
bus.
</p><!--l. 932--><p class="indent" > When using a DirectConnection rather than a DBusConnection most operations are the
same. The only things which differ are how you connect and the operations which depend on a
bus. Since peer connections are only one-to-one there is no destination or source
address to messages. There is also no <span
class="cmtt-12">org.freedesktop.DBus </span>service running on the
bus.
</p>
<h4 class="subsectionHead"><span class="titlemark">12.1 </span> <a
id="x36-3900012.1"></a>Connecting to another application</h4>
<!--l. 940--><p class="noindent" >To connect with a peer connection one of the two applications must be listening on the socket
and the other connecting. Both of these use the same method to instantiate the
<span
class="cmtt-12">DirectConnection </span>but with different addresses. To listen rather than connect you add the
<span
class="cmti-12">“listen=true” </span>parameter to the address. Listening and connecting can be seen in figures <a
href="#x36-3900117">17<!--tex4ht:ref: fig:p2plisten --></a> and
<a
href="#x36-3900218">18<!--tex4ht:ref: fig:p2pconnect --></a> respectively. Listening will block at creating the connection until the other application has
connected.
</p><!--l. 948--><p class="indent" > <span
class="cmtt-12">DirectConnection </span>also provides a <span
class="cmtt-12">createDynamicSession </span>method which generates a
random abstract unix socket address to use.
</p>
<hr class="figure" /><div class="figure"
>
<a
id="x36-3900117"></a>
<div class="center"
>
<!--l. 952--><p class="noindent" >
</p>
<div class="verbatim" id="verbatim-28">
DirectConnection dc = new DirectConnection("unix:path=/tmp/dbus-ABCXYZ,listen=true");
</div>
<!--l. 955--><p class="nopar" ></p></div>
<br /> <div class="caption"
><span class="id">Figure 17: </span><span
class="content">Listening for a peer connection</span></div><!--tex4ht:label?: x36-3900117 -->
</div><hr class="endfigure" />
<hr class="figure" /><div class="figure"
>
<a
id="x36-3900218"></a>
<div class="center"
>
<!--l. 962--><p class="noindent" >
</p>
<div class="verbatim" id="verbatim-29">
DirectConnection dc = new DirectConnection("unix:path=/tmp/dbus-ABCXYZ");
</div>
<!--l. 965--><p class="nopar" ></p></div>
<br /> <div class="caption"
><span class="id">Figure 18: </span><span
class="content">Connecting to a peer connection</span></div><!--tex4ht:label?: x36-3900218 -->
</div><hr class="endfigure" />
<h4 class="subsectionHead"><span class="titlemark">12.2 </span> <a
id="x36-4000012.2"></a>Getting Remote Objects</h4>
<!--l. 973--><p class="noindent" >Getting a remote object is essentially the same as with a bus connection, except that you do
not have to specify a bus name, only an object path. There is also no <span
class="cmtt-12">getPeerRemoteObject</span>
method, since there can only be one peer on this connection.
</p>
<hr class="figure" /><div class="figure"
>
<a
id="x36-4000119"></a>
<div class="center"
>
<!--l. 979--><p class="noindent" >
</p>
<div class="verbatim" id="verbatim-30">
RemoteInterface remote = dc.getRemoteObject("/Path");
 <br />remote.doStuff();
</div>
<!--l. 983--><p class="nopar" ></p></div>
<br /> <div class="caption"
><span class="id">Figure 19: </span><span
class="content">Getting a remote object on a peer connection</span></div><!--tex4ht:label?: x36-4000119 -->
</div><hr class="endfigure" />
<!--l. 989--><p class="indent" > The rest of the API is the same for peer connections as bus connections, ommiting any bus
addresses.
</p>
<!--l. 992--><div class="crosslinks"><p class="noindent">[<a
href="dbus-javase11.html" >prev</a>] [<a
href="dbus-javase11.html#taildbus-javase11.html" >prev-tail</a>] [<a
href="dbus-javase12.html" >front</a>] [<a
href="dbus-java.html# " >up</a>] </p></div>
<!--l. 992--><p class="indent" > <a
id="taildbus-javase12.html"></a> </p>
</body></html>
|