| 1234567891011121314151617181920212223242526272829303132333435 |
- #include "pch/pch.h"
- #include "network/CServer.h"
- int main()
- {
- //初始化日志
- CLewaimaiLog log;
- log.Init();
- //读取配置文件
- CConfigReader::ReadConfigFile();
- //开启守护进程
- if (daemon(0, 0) == -1)
- {
- exit(EXIT_FAILURE);
- }
- try
- {
- //初始化服务器,开始监听和处理消息
- CServer s;
- s.Init();
- }
- catch (std::exception& e)
- {
- std::cerr << "Exception: " << e.what() << "\n";
- LOG_ERROR("Exception: " << e.what());
- }
- LOG_ERROR("ready to exit program");
- return 0;
- }
|