Warning: This is a development version. The latest stable version is Version 4.0.1.

Code Example: Hello World

This simple example can be used for checking whether your build system has been successfully setup to use the rely library.

 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
#include <iostream>

#include <rely/decoder.hpp>
#include <rely/encoder.hpp>
#include <rely/version.hpp>

int main()
{
    std::size_t max_packet_bytes = 1400U;
    int64_t timeout = 120U;
    std::size_t max_stream_size = 125U;

    rely::encoder encoder;
    rely::decoder decoder;

    encoder.configure(max_packet_bytes, timeout, max_stream_size);
    decoder.configure(max_packet_bytes, timeout, max_stream_size);

    std::cout << "version:           " << rely::version() << "\n";

    std::cout << "encoder" << std::endl;
    std::cout << " max_packet_bytes: " << encoder.max_packet_bytes() << "\n";
    std::cout << " header_bytes:     " << encoder.header_bytes() << "\n";
    std::cout << " timeout:          " << encoder.timeout() << "\n";
    std::cout << " max_stream_size:  " << encoder.max_stream_size() << "\n";

    std::cout << "decoder" << std::endl;
    std::cout << " max_packet_bytes: " << decoder.max_packet_bytes() << "\n";
    std::cout << " header_bytes:     " << decoder.header_bytes() << "\n";
    std::cout << " timeout:          " << decoder.timeout() << "\n";
    std::cout << " max_stream_size:  " << decoder.max_stream_size() << "\n";

    return 0;
}
Versions
4.0.1
4.0.0
3.0.2
3.0.1
3.0.0
2.0.0
Development
latest