Skip to content

Commit 495659a

Browse files
committed
doc: replenish forward service in readme
1 parent 4dee554 commit 495659a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,24 @@ net-mux is an asynchronous connection multiplexing library built on tokio. It mu
2626

2727
**Examples**
2828

29+
### Echo Service
30+
2931
```sh
3032
$ cargo run --example tcp_server
3133
$ cargo run --example tcp_client
3234
```
3335

3436
This launches a TCP listener on the local loopback address, waiting for client connections. Each connection is wrapped as a mux session. The server and client interact over this single connection through multiple streams. The server receives messages from the client and writes them back unchanged, while the client reads strings from the standard input, sends them to the server, and prints the received messages.
3537

38+
### Forward Service
39+
40+
```sh
41+
$ cargo run --example forward_server
42+
$ cargo run --example forward_client
43+
```
44+
45+
This launches a forward server and client. The server listens on port 7777 for client connections and listens on port 8001 to forward its data to the client. The client connects to the server's port 7777 and forwards data from the local port 8000. If you start an HTTP service on port 8000 (e.g., `python -m http.server 8000`), you can access it via `http://127.0.0.1:8001`.
46+
3647
**Links**
3748

3849
- Usage [examples][examples]

0 commit comments

Comments
 (0)