Skip to content

Commit

Permalink
[doc] update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
LingkKang committed Jan 9, 2024
1 parent cd255a3 commit 4476b19
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# A simple RPC demo

Remote Procedure Call (RPC)
A simple RPC demo implemented in Go and Rust.

The server is already hosted on `test.lingkang.dev:8333` for testing.

The rustdoc of client side is hosted on [`lingkang.dev/rpc_demo/`](https://lingkang.dev/rpc_demo/client/index.html).

See this blog post for more details: [Implement RPC demo from scratch - Lingkang's Blog](https://lingkang.dev/2024/01/08/rpc/).

## Table of Contents

- [Table of Contents](#table-of-contents)
- [1. Server](#1-server)
- [1.1. Run](#11-run)
- [1.2. Output](#12-output)
- [2. Client](#2-client)
- [2.1. Run](#21-run)
- [2.2. Output](#22-output)
- [3. CLOC](#3-cloc)

## 1. Server

The server side is implemented in Go, under the `./server` directory.

### 1.1. Run

The server is already hosted on `test.lingkang.dev:8333`, but you can also run it locally:
To run it locally:

``` bash
cd server
Expand All @@ -27,10 +37,16 @@ Or build and run the binary:
``` bash
cd server
go build -o target/rpc_demo cmd/main.go
nohup ./target/rpc_demo &
./target/rpc_demo
```

Use `nohup ./server/target/rpc_demo >/dev/null 2>&1 &` to discard the output.
Or use `nohup` to run it in the background.

``` bash
nohup ./target/rpc_demo > ./target/output.txt 2>&1 & # keep the output
# or
nohup ./target/rpc_demo > /dev/null 2>&1 & # discard the output
```

### 1.2. Output

Expand Down Expand Up @@ -58,3 +74,24 @@ cargo run
A naive implementation of logger based on `log` crate is used in this demo:

![The running output of the client side](./img/client_running.png)

---

## 3. CLOC

Count lines of code:

``` txt
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Go 5 60 50 347
Rust 8 84 120 320
Markdown 2 51 0 119
YAML 2 13 2 45
PowerShell 1 7 0 8
TOML 1 2 1 7
-------------------------------------------------------------------------------
SUM: 19 217 173 846
-------------------------------------------------------------------------------
```

0 comments on commit 4476b19

Please sign in to comment.