Skip to content

Commit cad2880

Browse files
authored
Merge pull request #550 from sclaire-1/master
Edit tutorial: implementing_a_client.md
2 parents 6b860c3 + b2aaa8b commit cad2880

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

docs/src/tutorial/implementing_a_client.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
## Implementing a client
22

3-
Let's now implement the client for the chat.
4-
Because the protocol is line-based, the implementation is pretty straightforward:
3+
Since the protocol is line-based, implementing a client for the chat is straightforward:
54

65
* Lines read from stdin should be sent over the socket.
76
* Lines read from the socket should be echoed to stdout.
87

9-
Unlike the server, the client needs only limited concurrency, as it interacts with only a single user.
10-
For this reason, async doesn't bring a lot of performance benefits in this case.
8+
Although async does not significantly affect client performance (as unlike the server, the client interacts solely with one user and only needs limited concurrency), async is still useful for managing concurrency!
9+
10+
The client has to read from stdin and the socket *simultaneously*.
11+
Programming this with threads is cumbersome, especially when implementing a clean shutdown.
12+
With async, the `select!` macro is all that is needed.
1113

12-
However, async is still useful for managing concurrency!
13-
Specifically, the client should *simultaneously* read from stdin and from the socket.
14-
Programming this with threads is cumbersome, especially when implementing clean shutdown.
15-
With async, we can just use the `select!` macro.
1614

1715
```rust,edition2018
1816
# extern crate async_std;

0 commit comments

Comments
 (0)