Skip to content

Improve Consistency for Echo Example Programs #7250

Closed
@nskins

Description

@nskins

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:

  1. We could combine the echo.rs and echo-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).
  2. We could keep the echo examples separate (as echo-tcp.rs and echo-udp.rs) and separate the client program connect.rs into connect-tcp.rs and connect-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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions