You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Damir Dezeljin <pr...@nib.si> on 2002/11/21 17:38:02 UTC
Win32 inetd HOWTO?
Hi.
Is there any way to write my own inetd on Windows using APR.
On UNIX I can construct it as folow:
- a program bind, listen to a specified port and poll for incoming
connections
- when a new connection is made, it closes fd-s 0 (stdin), 1 (stdout) and
2 (stderr), accept the connection and dup it two times. In this way fd-s
0,1,2 will be the socket of the accepted connection.
- fork a new process
- close fd-s 0, 1, 2
In this way like with inetd, the child will have connection to the client
trough stdin or stdout or stderr.
Is there a way to do something similar on Windows by using APR.
I found apr_proc_create() and other functions, but I don't know (nor
understand) how I can pass socket descriptor to the client? The best
solution will be to pass it as stdin,... but I think that this isn't
portable, because Windows have diferent socket descriptors.
Any solution?
Regards,
Dezo
Re: Win32 inetd HOWTO?
Posted by rb...@apache.org.
On Thu, 21 Nov 2002, Damir Dezeljin wrote:
> Hi.
>
> Is there any way to write my own inetd on Windows using APR.
>
> On UNIX I can construct it as folow:
> - a program bind, listen to a specified port and poll for incoming
> connections
> - when a new connection is made, it closes fd-s 0 (stdin), 1 (stdout) and
> 2 (stderr), accept the connection and dup it two times. In this way fd-s
> 0,1,2 will be the socket of the accepted connection.
> - fork a new process
> - close fd-s 0, 1, 2
>
> In this way like with inetd, the child will have connection to the client
> trough stdin or stdout or stderr.
>
> Is there a way to do something similar on Windows by using APR.
> I found apr_proc_create() and other functions, but I don't know (nor
> understand) how I can pass socket descriptor to the client? The best
> solution will be to pass it as stdin,... but I think that this isn't
> portable, because Windows have diferent socket descriptors.
>
> Any solution?
People have been talking for a while about creating an APR type that
allows you to pass file/socket descriptors between processes. The
contstruct isn't that hard, and it can be done portably. However, nobody
has written the code yet. Without that code, I do not believe that what
you want is possible.
Ryan