dummy_server.md 936 Bytes
Newer Older
zyearn's avatar
zyearn committed
1 2 3 4 5 6 7 8 9 10 11
If your program only uses client in brpc or doesn't use brpc at all, but you also want to use built-in services in brpc. The thing you should do is to start an empty server, which is called **dummy server**.

# client in brpc is used

Create a file named dummy_server.port which contains a port number(such as 8888) in the running directory of program, a dummy server would be started at this port. All of the bvar in the same process can be seen by visiting its built-in service.
![img](../images/dummy_server_1.png) ![img](../images/dummy_server_2.png) 

![img](../images/dummy_server_3.png)

# brpc is not used at all

zhujiashun's avatar
zhujiashun committed
12
You must manually add the dummy server. First read [Getting Started](getting_started.md) to learn how to download and compile brpc, and then add the following code snippet at the program entry:
zyearn's avatar
zyearn committed
13 14 15 16 17 18 19 20 21 22 23 24

```c++
#include <brpc/server.h>
 
...
 
int main() {
    ...
    brpc::StartDummyServerAt(8888/*port*/);
    ...
}
```