Closed
Description
Problem
I believe there is a slight issue with the presentation of the "echo" examples: namely, echo.rs
and echo-udp.rs
. These examples create servers that listen on TCP and UDP (respectively). However, they interact with a "client" program called connect.rs
that handles the logic for sending both TCP and UDP payloads. I find it confusing that the client logic for TCP and UDP would be bundled into one file while the server logic would be split across two separate programs. It would be easier to understand if both the client and the server had a similar interface for the end user.
Suggested Solution
I see two ways of resolving this:
- We could combine the
echo.rs
andecho-udp.rs
examples into a single file (say,echo.rs
) with a command-line argument to indicate which protocol to use (connect.rs
does this with--udp
). This might make more sense for maintainability (i.e. reusing common code). - We could keep the echo examples separate (as
echo-tcp.rs
andecho-udp.rs
) and separate the client programconnect.rs
intoconnect-tcp.rs
andconnect-udp.rs
. This might make more sense for ease of learning (since it keeps the separate pairs of examples simple).
Curious to hear what others think. I'd be happy to submit a PR if we determine a change should be made!