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

AF-Unix #53

Open
janus opened this issue Apr 7, 2015 · 1 comment
Open

AF-Unix #53

janus opened this issue Apr 7, 2015 · 1 comment

Comments

@janus
Copy link

janus commented Apr 7, 2015

I was a bit confused while going through your code particularly when I noticed that socket used "AF-Unix" . Why using it? I also noticed that now you have epoll, thread, and select. I fcntl and thread, but what do you again with epoll

@truongminh
Copy link
Contributor

Why does nope.c use AF_UNIX socket?

With NOPE_THREADS enabled, the worker and master threads needs someway to communicate with the other. In this case, nope.c use a socketpair to make the communication between the master and a worker asynchronous.

If you want to communicate with a remote host, then you will probably need an INET socket.
The difference is that an INET socket is bound to an IP address-port tuple, while a UNIX socket is "bound" to a special file on your filesystem. Generally, only processes running on the same machine can communicate through the latter.

So, why would one use a UNIX socket? Exactly for the reason above: communication between processes on the same host, being a lightweight alternative to an INET socket via loopback.

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

No branches or pull requests

2 participants