This is just a toy, please don't use it in your project
kurisu_u
is a modern C++ network library for developing high performance server, supports only TCP
protocols and Linux
. kurisu_u
provides a TCP Server to support multi-threaded and nonblocking IO
- High-performance logging with sync and async logging support
LengthCodec
to unpack, very similar to netty'sLengthFieldBasedFrameDecoder
- Supports heartbeat, you can have the server send msg to all clients at the interval you set
ShutdownTimingWheel
to shutdown the client connection which don't send msg for the time you set(usually used with heartbeat)
GCC >= 7.1(supports C++17 or above)
fmt(will be installed when build kurisu_u
)
Check the g++/gcc version:
$ g++ --version
$ gcc --version
Ubuntu:
$ sudo apt install cmake make
CentOS:
$ sudo yum install cmake make
make sure you are in thr root directory kurisu_u
$ mkdir build && cd build
$ cmake ..
$ make -j$(nproc)
$ sudo make install
#include <kurisu/kurisu.h>
int main()
{
kurisu::EventLoop loop;
kurisu::TcpServer server(&loop, kurisu::SockAddr(5005), "echo"); //listen port 5005
server.SetMessageCallback([](const std::shared_ptr<kurisu::TcpConnection>& conn, kurisu::Buffer* buf, kurisu::Timestamp) {
LOG_INFO << "recv msg:" << buf->ToString();
conn->Send(buf);
});
server.Start();
loop.Loop();
}
More details here example.md
More details here benchmark.md
Thanks Chen Shuo,kurisu_u
is highly inspired by muduo.
Thanks fmt,kurisu_u
's time formatting depends on it.