Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

echo_op example #1347

Closed
wants to merge 4 commits into from
Closed

echo_op example #1347

wants to merge 4 commits into from

Conversation

octobanana
Copy link
Contributor

Set the reuse_address socket option to match the style of the other examples.


Add the ability to set the listening address and port through command line arguments. Print out usage and return error exit status on invalid or missing arguments.


Currently, the echo-op example uses the carriage return \r delimiter for async_read_until. Running the server and sending a message to it with curl or netcat:

printf 'Hello, World!\r\n' | nc 127.0.0.1 8080

leads to some potentially confusing behaviour. The async_read_until function reads up to and including the first \r. When the message is received by the client and printed to stdout, the trailing \r ends up moving the cursor back to the start of the line, resulting in the prompt overwriting the message. It appears as if nothing has happened.

If async_read_until uses the newline \n as the delimiter, the echoed output will not be overwritten, regardless of whether the line ends in \n or \r\n.


Had a go at adding a synchronous echo op function #1275.

@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #1347 into develop will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1347      +/-   ##
===========================================
+ Coverage    92.06%   92.07%   +<.01%     
===========================================
  Files          124      124              
  Lines        11526    11526              
===========================================
+ Hits         10611    10612       +1     
+ Misses         915      914       -1
Impacted Files Coverage Δ
include/boost/beast/core/impl/buffers_prefix.ipp 92.22% <0%> (+1.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 397c388...fc76c42. Read the comment docs.

@vinniefalco
Copy link
Member

The sync echo-op needs exposition and documentation...

@octobanana
Copy link
Contributor Author

It does, I'll add some documentation to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants