/usr/share/doc/libanet0.3.1-dev/index.html is in libanet0.3.1-dev 0.3.1-1ubuntu1.
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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<title>Anet</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css" />
</head>
<body class="article">
<table class="main" cellspacing="0" cellpadding="0"><tr><td class="header">
<div id="header">
<h1>Anet</h1>
</div>
</td></tr>
<tr><td class="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>Anet is a networking library for the Ada programming language.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_features">Features</h2>
<div class="sectionbody">
<div class="paragraph"><p>The Anet networking library has the following features:</p></div>
<div class="ulist"><ul>
<li>
<p>
BSD socket implementation
</p>
</li>
<li>
<p>
High abstraction level
</p>
</li>
<li>
<p>
Extendable socket type hierarchy
</p>
</li>
<li>
<p>
Socket receiver tasks (Stream and Datagram)
</p>
</li>
<li>
<p>
Ada type serialisation/deserialisation over sockets
</p>
</li>
<li>
<p>
Supported socket families
</p>
<div class="ulist"><ul>
<li>
<p>
IPv4 (AF_INET)
</p>
</li>
<li>
<p>
IPv6 (AF_INET6)
</p>
</li>
<li>
<p>
Packet (AF_PACKET)
</p>
</li>
<li>
<p>
UNIX domain (AF_UNIX)
</p>
</li>
<li>
<p>
Netlink (AF_NETLINK)
</p>
</li>
</ul></div>
</li>
<li>
<p>
Supported socket modes
</p>
<div class="ulist"><ul>
<li>
<p>
Stream (TCP)
</p>
</li>
<li>
<p>
Datagram (UDP)
</p>
</li>
<li>
<p>
RAW
</p>
</li>
</ul></div>
</li>
<li>
<p>
Support for IPv4/IPv6 multicast
</p>
</li>
<li>
<p>
UDP/IPv4 packet creation and validation
</p>
</li>
<li>
<p>
Binding to the Linux Packet Filter (LPF) system
</p>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_download">Download</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_release_version">Release version</h3>
<div class="paragraph"><p>The current release version of Anet is available at
<a href="http://www.codelabs.ch/download/">http://www.codelabs.ch/download/</a>.</p></div>
</div>
<div class="sect2">
<h3 id="_verify_a_release">Verify a Release</h3>
<div class="paragraph"><p>To verify the integrity and authenticity of the distribution tarball, import
the key <a href="http://www.codelabs.ch/keys/0xBB793815pub.asc">http://www.codelabs.ch/keys/0xBB793815pub.asc</a> and type the following
command:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$ gpg --verify libanet-{version}.tar.bz2.sig</tt></pre>
</div></div>
<div class="paragraph"><p>The key fingerprint of the public key (<em>0xBB793815</em>) is:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>Key fingerprint = A2FB FF56 83FB 67D8 017B C50C F8C5 F8B5 BB79 3815</tt></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_development_version">Development version</h3>
<div class="paragraph"><p>The current development version of Anet is available through its git repository:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$ git clone http://git.codelabs.ch/git/anet.git</tt></pre>
</div></div>
<div class="paragraph"><p>A browsable version of the repository is also available here:
<a href="http://git.codelabs.ch/?p=anet.git">http://git.codelabs.ch/?p=anet.git</a></p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_installation">Installation</h2>
<div class="sectionbody">
<div class="paragraph"><p>To compile and install Anet on your system, you need to have the following
software installed:</p></div>
<div class="ulist"><ul>
<li>
<p>
GNAT Ada compiler:
<a href="http://www.gnu.org/software/gnat/gnat.html">http://www.gnu.org/software/gnat/gnat.html</a>
</p>
</li>
</ul></div>
<div class="paragraph"><p>If you want to run the unit tests before installation of Anet (which is
recommended) you furthermore need to have the following installed:</p></div>
<div class="ulist"><ul>
<li>
<p>
Ahven (Test-Framework):
<a href="http://ahven.stronglytyped.org/">http://ahven.stronglytyped.org/</a>
</p>
</li>
</ul></div>
<div class="paragraph"><p>Anet supports BSD and Linux operating systems. To build for BSD, append
<tt>OS=bsd</tt> to the <tt>make</tt> commands below. The building and installation process of
Anet is straightforward. Just type in the following commands.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$ make
$ make PREFIX=/usr/local install</tt></pre>
</div></div>
<div class="paragraph"><p>If neither <tt>PREFIX</tt> nor <tt>OS</tt> are specified, <tt>$(HOME)/libraries</tt> is used as
installation directory and the library is built for Linux.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_testing">Testing</h2>
<div class="sectionbody">
<div class="paragraph"><p>Anet contains a comprehensive unit test suite which can be run by entering the
following command:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$ make tests</tt></pre>
</div></div>
<div class="paragraph"><p>All tests should be marked with <strong>PASS</strong> behind the test name. To run the tests
on BSD, type:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$ make tests OS=bsd</tt></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_licence">Licence</h2>
<div class="sectionbody">
<div class="listingblock">
<div class="content">
<pre><tt>Copyright (C) 2011-2013 secunet Security Networks AG
Copyright (C) 2011-2014 Reto Buerki <reet@codelabs.ch>
Copyright (C) 2011-2014 Adrian-Ken Rueegsegger <ken@codelabs.ch>
Free use of this software is granted under the terms of the GNAT Modified
General Public License (GMGPL).</tt></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_example">Example</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_server_unix_tcp">Server (UNIX/TCP)</h3>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Copyright (C) 2012 secunet Security Networks AG</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Copyright (C) 2012 Reto Buerki <reet@codelabs.ch></span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Copyright (C) 2012 Adrian-Ken Rueegsegger <ken@codelabs.ch></span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- This program is free software; you can redistribute it and/or modify it</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- under the terms of the GNU General Public License as published by the</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Free Software Foundation; either version 2 of the License, or (at your</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- This program is distributed in the hope that it will be useful, but</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- for more details.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- As a special exception, if other files instantiate generics from this</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- unit, or you link this unit with other files to produce an</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- executable this unit does not by itself cause the resulting</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- executable to be covered by the GNU General Public License. This</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- exception does not however invalidate any other reasons why the</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- executable file might be covered by the GNU Public License.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Anet<span style="color: #990000">.</span>Streams<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Anet<span style="color: #990000">.</span>Sockets<span style="color: #990000">.</span>Unix<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Anet<span style="color: #990000">.</span>Receivers<span style="color: #990000">.</span>Stream<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">procedure</span></span> Server <span style="font-weight: bold"><span style="color: #0000FF">is</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">package</span></span> Unix_TCP_Receiver <span style="font-weight: bold"><span style="color: #0000FF">is</span></span> <span style="font-weight: bold"><span style="color: #0000FF">new</span></span> Anet<span style="color: #990000">.</span>Receivers<span style="color: #990000">.</span>Stream
<span style="color: #990000">(</span>Socket_Type <span style="color: #990000">=></span> Anet<span style="color: #990000">.</span>Sockets<span style="color: #990000">.</span>Unix<span style="color: #990000">.</span>TCP_Socket_Type<span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">procedure</span></span> Handle_Request
<span style="color: #990000">(</span>Recv_Data <span style="color: #990000">:</span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Array<span style="color: #990000">;</span>
Send_Data <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">out</span></span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Array<span style="color: #990000">;</span>
Send_Last <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">out</span></span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Offset<span style="color: #990000">);</span>
<span style="font-style: italic"><span style="color: #9A1900">-- Handle requests from clients.</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">procedure</span></span> Handle_Request
<span style="color: #990000">(</span>Recv_Data <span style="color: #990000">:</span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Array<span style="color: #990000">;</span>
Send_Data <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">out</span></span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Array<span style="color: #990000">;</span>
Send_Last <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">out</span></span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Offset<span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">is</span></span>
Stream <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">aliased</span></span> Anet<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Memory_Stream_Type</span></span> <span style="color: #990000">(</span>Max_Elements <span style="color: #990000">=></span> <span style="color: #993399">4</span><span style="color: #990000">);</span>
Number <span style="color: #990000">:</span> <span style="color: #009900">Integer</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">begin</span></span>
Stream<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Set_Buffer</span></span> <span style="color: #990000">(</span>Buffer <span style="color: #990000">=></span> Recv_Data<span style="color: #990000">);</span>
<span style="color: #009900">Integer</span><span style="color: #FF0000">'Read (Stream'</span><span style="font-weight: bold"><span style="color: #0000FF">Access</span></span><span style="color: #990000">,</span> Number<span style="color: #990000">);</span>
Number <span style="color: #990000">:=</span> Number <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">;</span>
<span style="color: #009900">Integer</span><span style="color: #FF0000">'Write (Stream'</span><span style="font-weight: bold"><span style="color: #0000FF">Access</span></span><span style="color: #990000">,</span> Number<span style="color: #990000">);</span>
Send_Last <span style="color: #990000">:=</span> Stream<span style="color: #990000">.</span>Get_Buffer'Length<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000000">Send_Data</span></span> <span style="color: #990000">(</span>Send_Data'First <span style="color: #990000">..</span> Send_Last<span style="color: #990000">)</span> <span style="color: #990000">:=</span> Stream<span style="color: #990000">.</span>Get_Buffer<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span> Handle_Request<span style="color: #990000">;</span>
Socket <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">aliased</span></span> Anet<span style="color: #990000">.</span>Sockets<span style="color: #990000">.</span>Unix<span style="color: #990000">.</span>TCP_Socket_Type<span style="color: #990000">;</span>
Receiver <span style="color: #990000">:</span> Unix_TCP_Receiver<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Receiver_Type</span></span> <span style="color: #990000">(</span>S <span style="color: #990000">=></span> Socket'<span style="font-weight: bold"><span style="color: #0000FF">Access</span></span><span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">begin</span></span>
Socket<span style="color: #990000">.</span>Init<span style="color: #990000">;</span>
Socket<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Bind</span></span> <span style="color: #990000">(</span>Path <span style="color: #990000">=></span> <span style="color: #FF0000">"/tmp/anet.example"</span><span style="color: #990000">);</span>
Receiver<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Listen</span></span> <span style="color: #990000">(</span>Callback <span style="color: #990000">=></span> Handle_Request'<span style="font-weight: bold"><span style="color: #0000FF">Access</span></span><span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span> Server<span style="color: #990000">;</span></tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_client_unix_tcp">Client (UNIX/TCP)</h3>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Copyright (C) 2012 secunet Security Networks AG</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Copyright (C) 2012 Reto Buerki <reet@codelabs.ch></span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Copyright (C) 2012 Adrian-Ken Rueegsegger <ken@codelabs.ch></span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- This program is free software; you can redistribute it and/or modify it</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- under the terms of the GNU General Public License as published by the</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- Free Software Foundation; either version 2 of the License, or (at your</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- This program is distributed in the hope that it will be useful, but</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- for more details.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- As a special exception, if other files instantiate generics from this</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- unit, or you link this unit with other files to produce an</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- executable this unit does not by itself cause the resulting</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- executable to be covered by the GNU General Public License. This</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- exception does not however invalidate any other reasons why the</span></span>
<span style="font-style: italic"><span style="color: #9A1900">-- executable file might be covered by the GNU Public License.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">--</span></span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Ada<span style="color: #990000">.</span>Text_IO<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Anet<span style="color: #990000">.</span>Streams<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #000080">with</span></span> Anet<span style="color: #990000">.</span>Sockets<span style="color: #990000">.</span>Unix<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">procedure</span></span> Client <span style="font-weight: bold"><span style="color: #0000FF">is</span></span>
Number <span style="color: #990000">:</span> <span style="color: #009900">Integer</span> <span style="color: #990000">:=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
Socket <span style="color: #990000">:</span> Anet<span style="color: #990000">.</span>Sockets<span style="color: #990000">.</span>Unix<span style="color: #990000">.</span>TCP_Socket_Type<span style="color: #990000">;</span>
Stream <span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">aliased</span></span> Anet<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Memory_Stream_Type</span></span> <span style="color: #990000">(</span>Max_Elements <span style="color: #990000">=></span> <span style="color: #993399">4</span><span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">begin</span></span>
Socket<span style="color: #990000">.</span>Init<span style="color: #990000">;</span>
Socket<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Connect</span></span> <span style="color: #990000">(</span>Path <span style="color: #990000">=></span> <span style="color: #FF0000">"/tmp/anet.example"</span><span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">loop</span></span>
Ada<span style="color: #990000">.</span>Text_IO<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Put_Line</span></span> <span style="color: #990000">(</span><span style="color: #FF0000">"PING"</span> <span style="color: #990000">&</span> Number'Img<span style="color: #990000">);</span>
<span style="color: #009900">Integer</span><span style="color: #FF0000">'Write (Stream'</span><span style="font-weight: bold"><span style="color: #0000FF">Access</span></span><span style="color: #990000">,</span> Number<span style="color: #990000">);</span>
Socket<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Send</span></span> <span style="color: #990000">(</span>Item <span style="color: #990000">=></span> Stream<span style="color: #990000">.</span>Get_Buffer<span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">declare</span></span>
Buffer <span style="color: #990000">:</span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Stream_Element_Array</span></span> <span style="color: #990000">(</span><span style="color: #993399">1</span> <span style="color: #990000">..</span> <span style="color: #993399">4</span><span style="color: #990000">);</span>
Last <span style="color: #990000">:</span> Ada<span style="color: #990000">.</span>Streams<span style="color: #990000">.</span>Stream_Element_Offset<span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">begin</span></span>
Socket<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Receive</span></span> <span style="color: #990000">(</span>Item <span style="color: #990000">=></span> Buffer<span style="color: #990000">,</span>
Last <span style="color: #990000">=></span> Last<span style="color: #990000">);</span>
Stream<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Set_Buffer</span></span> <span style="color: #990000">(</span>Buffer <span style="color: #990000">=></span> <span style="font-weight: bold"><span style="color: #000000">Buffer</span></span> <span style="color: #990000">(</span>Buffer'First <span style="color: #990000">..</span> Last<span style="color: #990000">));</span>
<span style="color: #009900">Integer</span><span style="color: #FF0000">'Read (Stream'</span><span style="font-weight: bold"><span style="color: #0000FF">Access</span></span><span style="color: #990000">,</span> Number<span style="color: #990000">);</span>
Ada<span style="color: #990000">.</span>Text_IO<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">Put_Line</span></span> <span style="color: #990000">(</span><span style="color: #FF0000">"PONG"</span> <span style="color: #990000">&</span> Number'Img<span style="color: #990000">);</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">delay</span></span> <span style="color: #993399">1.0</span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span> <span style="font-weight: bold"><span style="color: #0000FF">loop</span></span><span style="color: #990000">;</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span> Client<span style="color: #990000">;</span></tt></pre></div></div>
</div>
</div>
</div>
</td></tr><tr><td class="footer">
<div id="footer">
<div id="footer-text">
Last updated 2014-08-11 22:03:22 UTC
</div>
</div>
</td></tr></table>
</body>
</html>
|