Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.77 KB

README.md

File metadata and controls

36 lines (29 loc) · 1.77 KB

twistedcpp

Porting twisted to C++ using boost::asio coroutines.

#include <twisted/reactor.hpp>
#include <twisted/basic_protocol.hpp>

struct echo_protocol : twisted::basic_protocol<echo_protocol> {
    void on_message(const_buffer_iterator begin, const_buffer_iterator end) { 
        send_message(begin, end);
    }
};

int main() {
    twisted::reactor reac;
    reac.listen_tcp<echo_protocol>(50000);
    reac.run();
}

Feature Support

Check the [Tutorials] (https://github.com/StephanDollberg/twistedcpp/wiki/Tutorials) for a detailed explanation of everything.

Using/Installing twistedcpp

twistedcpp is header only so you don't need to build anything. You can either add include/twisted to your compiler include path(e.g.: -I/path/to/twisted/include or put it to /usr/local/include) or copy the files to your local project. However, twistedcpp depends on boost asio and if the ssl part is used also on openssl. Meaning that you have to link against -lboost_coroutine, -lboost_context, -lboost_system, -lssl and -lcrypto.

More work, help and projects very appreciated.