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

Add unix domain socket support #803

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

na-trium-144
Copy link
Contributor

I wanted to use unix domain socket since performance is important in my project, so I implemented based on ipkn/crow#379.
Instead of duplicating App and Server classes, I created wrapper class of acceptor so the existing Server class can be used for unix socket connection.

By specifying socket path with app.unix_path() (instead of app.port(port_num)) the server will create and use that socket instead of listening a tcp socket. (I added example as example/example_unix_socket.cpp)
Although it is named unix socket, this also works on windows.

If there is any problem please let me know.
Especially I am not sure if there is a better name than unix_path().

@mrozigor
Copy link
Member

mrozigor commented Jun 4, 2024

Maybe rename it if it also works on Windows? Maybe something like external_socket_path or something like this?

@na-trium-144
Copy link
Contributor Author

Actually it is named "unix socket" (or AF_UNIX) on Windows: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
But Asio's documentation says it is also known as local sockets, so maybe local_socket_path is ok if "unix" is confusing.
https://think-async.com/Asio/boost_asio_1_18_0/doc/html/boost_asio/overview/posix/local.html

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.

None yet

2 participants