On Sun, Jan 3, 2016 at 4:13 PM, Peter Hodur <[email protected]> wrote:
> Not exactly.
>
> My server will listen on some socket to accept connections from clients on 
> well known port. When client connect, server will accept connection and exec 
> external binary (fork/exec). This external binary open another local socket 
> and lent know main server to know it is ready by sending its path on stdout. 
> When server gets this socket, it open it and from this point server acts as 
> active proxy between client and external binary.
>
> If all external binaries can be spawned onece at start, it is simple. But 
> fork/exec plus initialization in external binary is not cheap operation. So i 
> can not simply call fork followed by exec and waitpid inside main loop. It 
> will block another clients.
>
> So i hope i can fork/exec in another thread. But i do not know if it is safe 
> ;)
>
> Have a nice day!
>
> Pete

Not sure if it fits in your architecture but you can spawn child
processes upfront with an IPC channel that you use for sending over
handles.  Call uv_pipe_init() with ipc=1 and pass the pipe to
uv_spawn(), then use uv_write2() to send over handles.

Alternatively, if you want to send handles over an existing UNIX
socket, call uv_pipe_init() with ipc=1 followed by uv_pipe_connect().
The listening process should be prepared for auxiliary messages, i.e.,
it should read from the socket with recvmsg(2) where msg.msg_control
!= NULL.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to