“帝江”是一个通信框架,底层可以使用TCP方式或者RDMA方式。
SAY("Server");
auto socket = std::make_shared<RdmaServerSocket>(port, threadNum, messageBufferSize);
auto handler = [](char *buffer, int size)
{
std::string str(buffer, size);
fprintf(stdout, "dijinag -> size is: %d, content is: %s, \n", size, str.c_str());
};
socket->RegisterHandler(handler);
socket->Loop();
SAY("Client");
int timeout = 500;
auto socket = std::make_shared<RdmaClientSocket>(ip, port, threadNum, messageBufferSize, timeout);
char data[] = "hello,world";
int size = strlen(data);
socket->Write(data, size);
帝江,《山海经》中的神兽,人面鸟身,背有四张肉翅,胸前、腹部、双腿六爪;善速度,四翅一扇二十八万里。