Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 forasync_read_until
. Running the server and sending a message to it with curl or netcat: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.