Reticulum/docs/source/examples.rst

128 lines
3.5 KiB
ReStructuredText
Raw Normal View History

2021-05-16 13:58:11 -06:00
.. _examples-main:
2021-09-25 15:22:33 -06:00
*************
Code Examples
*************
2021-05-16 13:58:11 -06:00
A number of examples are included in the source distribution of Reticulum.
You can use these examples to learn how to write your own programs.
2021-05-16 15:13:56 -06:00
.. _example-minimal:
2021-05-16 13:58:11 -06:00
Minimal
=======
The *Minimal* example demonstrates the bare-minimum setup required to connect to
a Reticulum network from your program. In about five lines of code, you will
have the Reticulum Network Stack initialised, and ready to pass traffic in your
program.
2021-05-17 03:32:00 -06:00
.. literalinclude:: ../../Examples/Minimal.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Minimal.py>`_.
2021-05-16 15:13:56 -06:00
.. _example-announce:
2021-05-16 13:58:11 -06:00
Announce
========
The *Announce* example builds upon the previous example by exploring how to
announce a destination on the network, and how to let your program receive
notifications about announces from relevant destinations.
2021-05-17 03:32:00 -06:00
.. literalinclude:: ../../Examples/Announce.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Announce.py>`_.
2021-05-16 15:13:56 -06:00
.. _example-broadcast:
2021-05-16 13:58:11 -06:00
Broadcast
=========
The *Broadcast* example explores how to transmit plaintext broadcast messages
over the network.
2021-05-17 03:32:00 -06:00
.. literalinclude:: ../../Examples/Broadcast.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Broadcast.py>`_.
2021-05-16 15:13:56 -06:00
.. _example-echo:
2021-05-16 13:58:11 -06:00
Echo
====
The *Echo* example demonstrates communication between two destinations using
the Packet interface.
2021-05-17 03:32:00 -06:00
.. literalinclude:: ../../Examples/Echo.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Echo.py>`_.
2021-05-16 13:58:11 -06:00
.. _example-link:
Link
====
The *Link* example explores establishing an encrypted link to a remote
destination, and passing traffic back and forth over the link.
2021-05-17 03:32:00 -06:00
.. literalinclude:: ../../Examples/Link.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Link.py>`_.
2021-08-19 06:11:22 -06:00
.. _example-identify:
Identification
==============
The *Identify* example explores identifying an intiator of a link, once
the link has been established.
.. literalinclude:: ../../Examples/Identify.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Identify.py>`_.
2021-08-20 15:29:06 -06:00
.. _example-request:
Requests & Responses
====================
The *Request* example explores sendig requests and receiving responses.
.. literalinclude:: ../../Examples/Request.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Request.py>`_.
2023-02-27 20:10:28 -07:00
.. _example-channel:
Channel
2023-03-02 04:47:55 -07:00
=======
2023-02-27 20:10:28 -07:00
The *Channel* example explores using a ``Channel`` to send structured
data between peers of a ``Link``.
.. literalinclude:: ../../Examples/Channel.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Channel.py>`_.
2023-03-02 16:21:32 -07:00
Buffer
======
The *Buffer* example explores using buffered readers and writers to send
binary data between peers of a ``Link``.
.. literalinclude:: ../../Examples/Buffer.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Buffer.py>`_.
2021-05-16 15:13:56 -06:00
.. _example-filetransfer:
2021-05-16 13:58:11 -06:00
Filetransfer
============
The *Filetransfer* example implements a basic file-server program that
allow clients to connect and download files. The program uses the Resource
2021-05-17 03:32:00 -06:00
interface to efficiently pass files of any size over a Reticulum :ref:`Link<api-link>`.
.. literalinclude:: ../../Examples/Filetransfer.py
This example can also be found at `<https://github.com/markqvist/Reticulum/blob/master/Examples/Filetransfer.py>`_.