Network is a easy scalable labrary for simplifying working with socket API (non blocking/blocking mode). TCP, SCTP, SSL + TCP, SSL + SCTP, DTLS
- Small labrary. It's easy to write write server/client applications based on it. By default it is using non blocking sockets
- It has universal interface for many streaming protocols ( tcp (+ ssl), sctp (+ ssl), dtls )
- Doesn't use exceptions. To handle errors you can set your callback function stream->set_state_changed_cb(cb_function) and check when a socket will become inactive !stream->is_active(). we can get error description stream->get_error_description()
- It has minimal dependecies.
- Easy to test application. You need only to implement stream interface and check what data your application send.
- It's easy to change socket type hence it's easy to move from tcp to ssl+tcp and vice versa
- If socket fails we can easily recreate it failed_stream = manager.create_stream(failed_stream->get_settings()); Hence we can have pool of streams and recreate if some of them fails.
You need cmake
- mkdir build
- cd build
- cmake ../
- cmake build options (by default build only plain TCP/UDP support)
- with TCP SSL support -DWITH_TCP_SSL=ON
- with UDP SSL support -DWITH_UDP_SSL=ON
- with SCTP support -DWITH_SCTP=ON
- with SCTP SSL support -DWITH_SCTP_SSL=ON
- buid examples -DWITH_EXAMPLES=ON
- use custom open ssl build (actual for SCTP + SSL and dtls) -DOPENSSL_DIR=/path/to/build/my-openssl
- use sanitizer -DWITH_SANITIZER=ON
- build all cmake -DWITH_SANITIZER=ON -DWITH_SCTP=ON -DWITH_SCTP_SSL=ON -DWITH_TCP_SSL=ON -DOPENSSL_DIR=/path/to/build/my-openssl -DWITH_EXAMPLES=ON -DWITH_UDP_SSL=ON ../
- cmake build options (by default build only plain TCP/UDP support)
- make
Simple server with non blocking sockets. No special preconditions.
Simple client with non blocking sockets. No special preconditions.
Server works as expected. No special preconditions. By default using non blocking mode. Using openSSL for secure connections
Client works as expected. No special preconditions. By default using non blocking mode.Using openSSL for secure connections
Simple client with non blocking sockets. Oriented only on one connection hence we need to set bind ip/port
Server works as expected. No special preconditions. By default using non blocking mode. Using openSSL for secure connections
Client works as expected. No special preconditions. By default using non blocking mode. Using openSSL for secure connections
You need to install libsctp - sudo apt-get install libsctp-dev
Server works as expected. No special preconditions. By default using non blocking mode. Using openSSL for secure connections
Client works as expected. No special preconditions. By default using non blocking mode.Using openSSL for secure connections
Server works good, but not so fast as I expected.
Unfortunately openssl is ready only for blocking mode.
There are many problems with SCTP implementation in openSSL
- First off all it is disabled by default. Hence you need to download it and build with SCTP support You can do it like this git clone git://git.openssl.org/openssl.git ./config sctp --prefix=$HOME/my-openssl/ && make -j8 && make -j8 install
- Enable support in linux sudo sysctl -w net.sctp.auth_enable=1
- It is slow (maybe need to discove why) ~50 messages per second
- Actual version of openSSL consist bug (openssl/openssl#20643)