Chapter 20 of the book Programming Rust (2nd), by Blandy, Orendorff, and Tindal
The entire stucture:
.
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
└── src
├── bin
│ ├── client.rs
│ └── server
│ ├── connection.rs
│ ├── group.rs
│ ├── group_table.rs
│ └── main.rs
├── lib.rs
└── utils.rs
To run the server, type:
$ cargo run --release --bin server -- localhost:8088
To run the client, type:
$ cargo run --release --bin client -- localhost:8088
The client supports only two commands:
-
join group
- Join the group namedgroup
. If that group does not exist, it is created. The name of the group must not contain any spaces. -
post group message
- Postmessage
to the chat group namedgroup
. The group name must not contain any spaces, but the message can.
There is no command to leave a group. There is no concept of a user name. To exit the client, hit ctrl-D on Linux or macOS, or ctrl-Z on Windows.
An example client session:
$ cargo run --release --bin client -- localhost:8088
Finished release [optimized] target(s) in 0.04s
Running `/home/chapters/asynchronous/target/release/client 'localhost:8088'`
Commands:
join GROUP
post GROUP MESSAGE...
Type Control-D (on Unix) or Control-Z (on Windows) to close the connection.
join Rust
post Rust I love Rust!
message posted to Rust: I love Rust!
message posted to Rust: LOL, I do too!
message posted to Rust: Hello, rust lovers!
post Rust Hi!
message posted to Rust: Hi!
ctrl-D
$
async-chat's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.