Ver Fonte

Translate dummy_server.md

zyearn há 6 anos atrás
pai
commit
0588be2b5f
2 ficheiros alterados com 24 adições e 20 exclusões
  1. 0 20
      docs/cn/dummy_server.md
  2. 24 0
      docs/en/dummy_server.md

+ 0 - 20
docs/cn/dummy_server.md

@@ -16,26 +16,6 @@
  
 ...
  
-int main() {
-    ...
-    brpc::Server dummy_server;
-    brpc::ServerOptions dummy_server_options;
-    dummy_server_options.num_threads = 0;  // 不要改变寄主程序的线程数。
-    if (dummy_server.Start(8888/*port*/, &dummy_server_options) != 0) {
-        LOG(FATAL) << "Fail to start dummy server";
-        return -1;
-    }
-    ...
-}
-```
-
-r31803之后加入dummy server更容易了,只要一行:
-
-```c++
-#include <brpc/server.h>
- 
-...
- 
 int main() {
     ...
     brpc::StartDummyServerAt(8888/*port*/);

+ 24 - 0
docs/en/dummy_server.md

@@ -0,0 +1,24 @@
+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
+
+You must manually add the dummy server. You have to 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:
+
+```c++
+#include <brpc/server.h>
+ 
+...
+ 
+int main() {
+    ...
+    brpc::StartDummyServerAt(8888/*port*/);
+    ...
+}
+```