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

568 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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.