FIX 4.0 Demo 1.0
Loading...
Searching...
No Matches
fix40::FixServer Class Reference

FIX 协议服务端 More...

#include <server.hpp>

Collaboration diagram for fix40::FixServer:
Collaboration graph

Public Member Functions

 FixServer (int port, int num_threads, Application *app=nullptr)
 构造服务端
 
 ~FixServer ()
 析构函数
 
void start ()
 启动服务端
 

Detailed Description

FIX 协议服务端

实现 FIX 协议服务端,主要功能:

  • 监听 TCP 端口,接受客户端连接
  • 为每个连接创建 SessionConnection
  • 使用 Reactor 模式处理 I/O 事件
  • 使用线程池处理业务逻辑
  • 支持 SIGINT/SIGTERM 信号优雅关闭
线程模型
  • Reactor 线程:负责 I/O 事件检测
  • 工作线程池:负责消息处理,每个连接绑定到固定线程
使用示例
FixServer server(9000, 4); // 端口 9000,4 个工作线程
server.start(); // 阻塞直到收到停止信号
FIX 协议服务端
Definition server.hpp:47

Constructor & Destructor Documentation

◆ FixServer()

fix40::FixServer::FixServer ( int  port,
int  num_threads,
Application app = nullptr 
)

构造服务端

Parameters
port监听端口
num_threads工作线程数(0 表示使用 CPU 核心数)
app应用层处理器指针(可选,用于处理业务消息)
Exceptions
std::runtime_error创建 socket 或绑定失败时抛出
Here is the call graph for this function:

◆ ~FixServer()

fix40::FixServer::~FixServer ( )

析构函数

停止 Reactor,关闭监听 socket。

Member Function Documentation

◆ start()

void fix40::FixServer::start ( )

启动服务端

阻塞当前线程,运行事件循环直到收到停止信号。 收到 SIGINT/SIGTERM 后执行优雅关闭流程。

Here is the caller graph for this function:

The documentation for this class was generated from the following files: