一个跨平台的c++<->lua服务器快速解决方案,该框架即可快速响应服务器开发工作,设计思想:“让事情变得更简单”
A cross platform C + + < - > Lua server fast solution, the framework can quickly respond to the server development work, the design idea: "make things easier"
classINetEvent : publicNetEvent
{
public:virtualvoidonAccept(NetConnect * conn){}
virtualvoidonClose(NetConnect * conn){}
virtualvoidonMsg(NetConnect * conn, int msgtype, NetPacket * pack){}
};
intmain()
{
EventLoop::Instance()->init();
INetEvent eve;
NetServer server(EventLoop::Instance(), &eve);
server.listen("127.0.0.1", 3001);
returnEventLoop::Instance()->run();
}event_init()
server=NetServer:new()
server.on_accept=function(conn)
endserver.on_close=function(conn)
endserver.on_msg=function(conn, msgtype, pack)
endserver:listen("127.0.0.1", 3001, false)
event_run()| base process | cell process | db process |
|---|---|---|
| start engine.exe base.lua | start engine.exe cell.lua | start engine.exe db.lua |
The serialization tool provided is experimental and may be fragile. It is recommended to use more powerful protobuf
libuv
sol2
concurrentqueue
lua
hiredis
kcp
lua-protobuf
http-parser
llhttp
For more examples, please refer to example
有任何建议、BUG、疑问,统一解决QQ群:458421068
My email: jw_cpp@163.com