/usr/share/gtk-doc/html/gnet/gnet-examples.html is in libgnet-dev 2.0.8-2.1.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GNet Examples</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GNet Network Library Reference Manual">
<link rel="up" href="index.html" title="GNet Network Library Reference Manual">
<link rel="prev" href="gnet-developers-async.html" title="Hiding blocking">
<link rel="next" href="gnet-examples-other.html" title="dnslookup, hash, hfetch, hostinfo, and SDR">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="gnet-overview.html" title="GNet Overview">
<link rel="chapter" href="gnet-developers.html" title="GNet for developers">
<link rel="chapter" href="gnet-examples.html" title="GNet Examples">
<link rel="chapter" href="libgnet-reference.html" title="GNet Library Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="gnet-developers-async.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td> </td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNet Network Library Reference Manual</th>
<td><a accesskey="n" href="gnet-examples-other.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter" lang="en">
<div class="titlepage"><div><div><h2 class="title">
<a name="gnet-examples"></a>GNet Examples</h2></div></div></div>
<div class="toc"><dl>
<dt><span class="sect1"><a href="gnet-examples.html#gnet-examples-echo">echoclient and echoserver</a></span></dt>
<dt><span class="sect1"><a href="gnet-examples-other.html">dnslookup, hash, hfetch, hostinfo, and SDR</a></span></dt>
</dl></div>
<p>
GNet comes with several example programs. They are intended to
be used by developers as examples of how to use GNet. The
example programs are in the examples directory that comes with
the source code.
</p>
<p>
The tests in the tests directory also demonstrate to use several
modules: MD5/SHA, InetAddr, IPv6, Pack/Unpack, and URI.
</p>
<div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="gnet-examples-echo"></a>echoclient and echoserver</h2></div></div></div>
<p>
The echoclient connects to the echoserver and sends data it
reads in from the user. echoserver then sends it back and
echoclient prints it out. These programs demonstrate how to
write a basic client and server. There are three versions of
the TCP echoclient and echoserver. Each demonstrates a
different method of using GNet: blocking, asynchronous, and
object GConn/GServer. There is also a blocking UDP example
and a Unix sockets example.
</p>
<p>
echoclient/echoserver. The blocking echoserver accepts a
connection and reads and writes to the socket until the socket
is closed. No more than one echoclient can be connected at
once. A good, robust server wouldn't use this method, but it
is suitable for many simple applications.
</p>
<p>
echoclient-async/echoserver-async. The
asynchronous server does not block while reading or writing to
a socket or waiting for a connect. Since it's never blocked,
it can accept new connections when it isn't reading or writing
to another socket. The advantage of the this method is that
multiple clients can be served at once.
</p>
<p>
echoclient-gconn/echoserver-gserver.
echoclient-gconn uses GNet's GConn object. echoserver-gserver
uses GNet's GServer object. GConn and GServer are high-level
wrappers around GTcpSocket. Using GConn and GServer is not as
flexible as using GTcpSocket directly, but it is much easier
and is flexible enough for most applications.
</p>
<p>
There is no example using threads. If you would like to
contribute one, please send it to us.
</p>
</div>
</div>
</body>
</html>
|