Let's say I create a socketpair()
and I pass the handle of one of the socket to a spawned process (popen
), will the said process be able to communicate back with the parent?
The examples I saw are applied using fork()
which is out of scope for my current project.
Updated: I tried a simple test:
Client:
socketpair
with sockets[0]From Client use
posix_spawn
with sockets[1] as command-line argumentClient:
write
to socket ... Client exits without any warning...
It would appear that there is a problem with this method.
UPDATED: I also found this note:
Pipes and socketpairs are limited to communication between processes with a common ancestor.