-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.cpp
38 lines (31 loc) · 1.16 KB
/
server.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//#include <cassert>
#include <string>
#include <iostream>
#include <gflags/gflags.h>
#include "common.h"
#include "ReceiverPool.h"
using namespace std;
using namespace transport;
DEFINE_string(transport, "nanomsg", "can be one of nanomsg,zmq,vma");
DEFINE_string(address, "192.168.1.1", "run server on this IP address");
DEFINE_int32(port, 24242, "base port, Nth thread will use this port +N");
DEFINE_int32(threads, 1, "number of threads");
int main(int argc, char *argv[]) {
::google::ParseCommandLineFlags(&argc, &argv, true);
Transport transport = Transport::TRANSPORT_NANOMSG;
if (FLAGS_transport == "nanomsg") {
transport = Transport::TRANSPORT_NANOMSG;
} else if (FLAGS_transport == "zmq") {
transport = Transport::TRANSPORT_ZMQ;
} else if (FLAGS_transport == "vma") {
transport = Transport::TRANSPORT_VMA;
} else if (FLAGS_transport == "rsockets") {
transport = Transport::TRANSPORT_RDMACM;
}
std::string address{FLAGS_address};
size_t port = FLAGS_port;
size_t threads = FLAGS_threads;
ReceiverPool &receiverPool = ReceiverPool::Instance(transport, address, port, threads);
cout << "Started " << receiverPool.size() << " threads" << endl;
return 0;
}