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

How to handle an existing UNIX socket? #257

Closed
nmkoremblum opened this issue Dec 22, 2021 · 4 comments
Closed

How to handle an existing UNIX socket? #257

nmkoremblum opened this issue Dec 22, 2021 · 4 comments
Assignees
Labels

Comments

@nmkoremblum
Copy link

Hi!

I am trying to handle a UNIX socket (PipeHandle) and I noticed that, when using the bind method, it creates such a file on the system. Now I am facing the problem that, when the socket already exists on the filesystem, the bind method fails, even though no other process is using it. I've also tried using connect but it fails too.

Do you have any advice on how to handle this situation?

Thanks in advance!

@stefanofiorentino
Copy link
Collaborator

Ciao @nmkoremblum, it is a thing that the application developer should take care of. If the application fails for whatever reason, it's its responsibility to cleanup dangling files. From the other way round, you can always cleanup on startup if you need to (not the best way, but works in many environment). Is it more clear to you now? Do you agree?

@nmkoremblum
Copy link
Author

Hi @stefanofiorentino! Thanks for answering 😄
I was expecting to have a workaround for connecting to an existing socket, of course removing the dangling files came up to my mind, but it seemed to be a naive solution. So, if there is no other way, I will go with that solution.
Thanks again :)

@skypjack
Copy link
Owner

Consider that uvw doesn't add anything on top of libuv, it's just a wrapper to correctly manage memory automatically.
Therefore, if it's not possible with libuv, it's not possible with uvw. I guess we're in this case here. 🙂

@stefanofiorentino
Copy link
Collaborator

stefanofiorentino commented Dec 23, 2021

Exactly, I'm sure there isn't a cross-platform way to do it. So no way libuv supports it.
I'll close this, feel free to reopen in case you think it needs more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants