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

TCPServer: explain how to get an ephermal port #11407

Merged
merged 2 commits into from
Nov 29, 2021

Conversation

rdp
Copy link
Contributor

@rdp rdp commented Nov 6, 2021

Explain how to be able to receive an ephermal port ("magic number" 0)

Explain how to be able to receive an ephermal port ("magic number" 0)
src/socket/tcp_server.cr Outdated Show resolved Hide resolved
Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
@oprypin oprypin changed the title Update tcp_server.cr TCPServer: explain how to get an ephermal port Nov 6, 2021
@@ -18,7 +18,9 @@ require "./tcp_socket"
# ```
#
# Options:
# - *backlog* to specify how many pending connections are allowed;
# - *host* local interface to bind on, or `::` to bind on all local interfaces.
# - *port* specific port to bind on, or `0` to receive an "ephemeral" (free, assigned by kernel) port.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it work the same way on BSD/Darwin and on Windows?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. All supported operating systems' implementations are based on the BSD socket API.

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Thank you @rdp 🙏

@straight-shoota straight-shoota added this to the 1.3.0 milestone Nov 26, 2021
@straight-shoota straight-shoota merged commit 8b200d7 into crystal-lang:master Nov 29, 2021
@rdp rdp deleted the patch-4 branch December 7, 2021 03:43
@straight-shoota straight-shoota changed the title TCPServer: explain how to get an ephermal port TCPServer: explain how to get an ephermal port Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants