Ch 04 - Solution for Mac users that want to run the epoll examples using docker #19
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.
Enable Running on Macs
Overview
Since Mac (and to a lesser extent Windows, though it has WSL) cannot work with epoll directly, Dockerfiles, Docker compose yml, and simple run scripts have been created so that users who have docker can run and test the ch04 examples on their system.
Details
A docker file has been created for delayserver as well and docker compose is used to run an epoll container and a delay server container and coordinate the network between them.
Some slight modification has been made to the epoll code to allow for an optional argument to be passed in which is the name of the host. When running the examples without docker and no arguments passed in (i.e.
cargo run
) "localhost" will be used by default. However when running docker containers epoll and delayserver are in separate containers, so epoll needs to transmit to the delayserver container (conveniently named "delayserver") instead of localhost. The dockerfiles supply the correct argument for the user.Debian slim rust containers have been used as they are a convenient and fairly small container for these kinds of rust projects.
README.md's have been updated to note that it is now possible to pass an optional argument for the hostname to connect to, which will default to "localhost" if no argument is passed.
Further Comments
I've supplied this as a convenience for perhaps other mac users who may pick up this book. Hopefully it doesn't unnecessarily clutter up the code base.