Re: Stdin/stdout tunneling through sockets to child process under Win9X
From: JJ (jjjj_at_nospam.com)
Date: 12/06/04
- Next message: Obi Wan: "WinSock TCP Buffer Status"
- Previous message: Steven Cheng[MSFT]: "RE: NetLocalGroupGetInfo return code 2220"
- In reply to: Bedrich Svoboda: "Re: Stdin/stdout tunneling through sockets to child process under Win9X"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 5 Dec 2004 20:17:23 -0500
I don't think this can be done with Windows 9x. You need a helper process
that sits between your process and the other process, passing the data back
and forth to the child via pipes.
See this article (note the last bullet):
http://support.microsoft.com/kb/q150523/
The article says this:
It is also common practice on Windows NT to set the standard handles
(standard input, output, or error) of the child process to the socket
handle. In such cases, the child process usually does not know that its
standard handles are actually sockets.
Windows 9x differs from Windows NT/Windows 2000 in the following manner:
- Socket handles are not inheritable when created. To ensure that a child
process can obtain and use a socket handle created in the parent, the handle
must be explicitly duplicated using the Win32 API DuplicateHandle. Set the
bInheritHandle parameter of the API to TRUE.
- Socket handles cannot be set to the standard handles of the child process.
A programmer may use other mechanisms to pass the socket handle to the
client, such as passing the handle values as command line arguments so that
the child process can simply look at its argument vector.
"Bedrich Svoboda" <bedrich.svoboda@post.cz> wrote in message
news:%23i8TA8q2EHA.524@TK2MSFTNGP09.phx.gbl...
>I have examined that example before. As you can see, my code is quite
>similar, but it uses sockets instead of anonymous pipes (I need to use
>telnet from different machines). That Microsoft code works well under both
>Win9X and Win2K+; my code with sockets works under Win2K+ only.
>
> The problem is that I haven't found any sample or description, on how
> sockets should behave when passed to child processes. Note that there is
> many sources describing handle passing to child processes OR using sockets
> as Windows handles, but none describing it together with information about
> Winsock/Windows kernel versions.
>
> "Eugene Gershnik" <gershnik@hotmail.com> wrote in message
> news:uTJyYqm2EHA.2876@TK2MSFTNGP12.phx.gbl...
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp
>
>
- Next message: Obi Wan: "WinSock TCP Buffer Status"
- Previous message: Steven Cheng[MSFT]: "RE: NetLocalGroupGetInfo return code 2220"
- In reply to: Bedrich Svoboda: "Re: Stdin/stdout tunneling through sockets to child process under Win9X"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|