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

Improve example server and client #41

Merged

Conversation

daveyarwood
Copy link
Contributor

I made these changes in order to test TCP support when I was implementing it for #37.

I was able to isolate this from the rest of #37 and branch it off of master, which simplifies things for review. This can be reviewed and merged separately from the rest of my PRs.

* Better debug output: nesting levels are indicated by indentation.

* Support debugging arbitrary levels of nested bundles.

* Use the higher-level server.ListenAndServe and a Dispatcher instance.
This was referenced Mar 9, 2020
On my subsequent branch that adds TCP, I added a second argument that is
the protocol to use. That's why these scripts currently expect 2
arguments. However, on _this_ branch, only the first argument is used,
and that first argument is the port. I ended up b0rking this when I
extracted this branch from the rest to make PR review easier.

This commit fixes it so that the scripts expect the correct number of
arguments, which is 1 argument, the port.
@daveyarwood
Copy link
Contributor Author

daveyarwood commented Feb 10, 2021

To test:

  • In one terminal, run go run examples/basic_server/basic_server.go 27278 (or the port of your choice)

  • In another terminal, run go run examples/client/client.go 27278 (the same port as before)

    • Enter m to send a random message or b to send a random bundle.
  • In the first terminal running the server, you will see the messages and bundles printed in a readable way, with indentation to represent the levels of nesting where bundles can contain bundles which contain messages, etc.

Copy link
Owner

@hypebeast hypebeast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Dave. Thanks a lot for the PR. Looks super nice :)

@hypebeast hypebeast merged commit d8d0c44 into hypebeast:master Mar 5, 2022
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