Skip to content

Allow user to set socket flags for server creation #13

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

Merged
merged 1 commit into from
Aug 29, 2017
Merged

Allow user to set socket flags for server creation #13

merged 1 commit into from
Aug 29, 2017

Conversation

curtpm
Copy link

@curtpm curtpm commented Aug 29, 2017

This will allow someone to specify NULL/nullptr for the host field and set AI_PASSIVE to allow listening to incoming requests on any connection (ie. localhost / ip4 / ip6)

@yhirose yhirose merged commit fd0828f into yhirose:master Aug 29, 2017
@yhirose
Copy link
Owner

yhirose commented Aug 29, 2017

@curtpm, thanks for the fine contribution. I added 2 test cases for the change.
In the 2nd test, I created the client socket with 'locashost' for the server made with AI_PASSIVE, and the test passed successfully. I think it's correct, right?

@curtpm
Copy link
Author

curtpm commented Aug 29, 2017

looks good to me!

FYI most server API's don't even support setting a host name on the "listen" function because 99% of the time you wan to listen to all connections on the system for the specified port.
ex: golang http ListenAndServe https://golang.org/pkg/net/http/#pkg-examples

Also thanks for accepting the request so fast!

@yhirose
Copy link
Owner

yhirose commented Aug 29, 2017

Thanks for the helpful information! 👍

@wangchuanfang wangchuanfang mentioned this pull request Feb 25, 2022
ExclusiveOrange pushed a commit to ExclusiveOrange/cpp-httplib-exor that referenced this pull request May 2, 2023
Allow user to set socket flags for server creation
@315567599 315567599 mentioned this pull request Jul 8, 2024
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