Skip to content

Commit

Permalink
update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
XinShuoWang committed Jan 5, 2022
1 parent 432d8d7 commit a9e485e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@
# 使用方式
## Server端
```
char port[] = "12345";
const int threadNum = 256;
RdmaServerSocket *socket = new RdmaServerSocket(port, threadNum);
auto handler = [](char *buffer, int size)
{
fprintf(stdout, "size is : %d \n", size);
std::string content(buffer, size);
fprintf(stdout, "content is: %s \n", content.c_str());
};
socket->RegisterMessageCallback(handler, messageBufferSize);
socket->Loop();
```

## Client端
```
SAY("Client");
char port[] = "12345";
char ip[] = "10.0.0.28";
RdmaClientSocket *socket = new RdmaClientSocket(ip, port, 16, 10 * 1024 * 1024, 500);
char message[] = "hello, world!";
socket->Write(message, strlen(message));
socket->Loop();
```


Expand Down

0 comments on commit a9e485e

Please sign in to comment.