Search code examples
node.jssocketsunixnode-ipc

If Unix socket `SOCK_STREAMS` are unidirectional, how is node-ipc bidirectional?


AFAIK, if a unix socket is created as type SOCK_STREAMS then it's unidirectional, and if SOCK_DGRAM then it's bidirectional.

I'm looking at using node-ipc for IPC via unix sockets. It has an example of a client and server that communicate supposedly via a unidirectional unix socket SOCK_STREAMS - yet seems to send messages in both directions.

What am I missing? Is the same socket path being used in two directions? Is it really using SOCK_STREAMS?


Solution

  • AFAIK, if a unix socket is created as type SOCK_STREAMS then it's unidirectional, and if SOCK_DGRAM then it's bidirectional.

    No. Domain SOCK_STREAMS are bi-directional as in the case of internet SOCK_STREAMS.