bind localPath in net.connect not supported #3705

Closed
santigimeno opened this Issue Jul 13, 2012 · 6 comments

Projects

None yet

3 participants

@santigimeno
Node.js Foundation member

I see it is possible to bind to a localAddress before connecting to a TCP server.
Is there a reason for not supporting the same functionality with unix stream sockets?

@bnoordhuis
Node.js Foundation member

I may be misunderstanding you but I don't see how that would work.

@bnoordhuis
Node.js Foundation member

/cc @piscisaureus

The idea is that you bind clients to named sockets so the server can discern them with getpeername().

@piscisaureus
Node.js Foundation member

I don't know if that'll work with unix sockets. With names pipes (windows) it definitely doesn't...

@santigimeno
Node.js Foundation member

With unix sockets it does work. For example, you can do

$ socat /tmp/local_socket UNIX-CONNECT:/tmp/remote_socket

If I had to implement it as a separate module, any module I can look at to have some inspiration?

@bnoordhuis
Node.js Foundation member

@santigimeno Try node-unix-dgram. Ping me on IRC if you have questions.

As to the feature request, I'm afraid we won't be able to implement it.

@bnoordhuis bnoordhuis closed this Jul 13, 2012
@santigimeno
Node.js Foundation member

For the sake of completeness:

https://github.com/santigimeno/node-unix-stream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment