[Ace-users] [ace-users] Pipes on Win32 and Unix

Steve Huston shuston at riverace.com
Thu Jan 31 17:43:15 CST 2008


Try writing 3 bytes on pipe[1]...

--
Steve Huston, Riverace Corporation
Want to take ACE training on YOUR schedule?
See http://www.riverace.com/training.htm


> -----Original Message-----
> From: ace-users-bounces at cse.wustl.edu 
> [mailto:ace-users-bounces at cse.wustl.edu] On Behalf Of Douglas 
> C. Schmidt
> Sent: Thursday, January 31, 2008 6:25 PM
> To: pivlev at gmail.com; ace-users at cse.wustl.edu
> Subject: Re: [ace-users] Pipes on Win32 and Unix
> 
> 
> Hi,
> 
>         Please take a look at
>         
> ACE_ROOT/tests/Pipe_Test.cpp
> ACE_ROOT/examples/OS/Process        
> 
> for some examples of using ACE_Pipe that are similar to what you're
> trying to do below.
> 
> Thanks,
> 
>         Doug
> 
> >Could anyone advise me how to make this code to run exactly the
same
> >on both Win32 and Unix ?
> >
> >==========
> >Main program:
> >
> >int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
> >{
> >		ACE_Process nmproc;
> >		ACE_Process_Options nm_opts;
> >		nm_opts.command_line("testEcho");
> >
> >		ACE_HANDLE pipe[2];
> > 		ACE_OS::pipe(pipe);
> >		nm_opts.set_handles(pipe[0]);
> >		ACE_OS::close(pipe[0]);
> >		nmproc.spawn(nm_opts);
> >		ACE_OS::write(pipe[1], "aa\n", 2);
> >		nm_opts.release_handles();
> >		ACE_OS::close(pipe[1]);
> >		return 0;
> >}
> >
> >==========
> >testEcho program:
> >
> >int main(int argc, char* argv[])
> >{
> >	printf("TestEcho started\n");
> >	char buf[100];
> >	scanf("%s", buf);
> >	fprintf(stdout, "StdOut:%s\n", buf);
> >	fprintf(stderr, "StdErr:%s\n", buf);
> >
> >	return 0;
> >}
> >
> >
> >==========
> >On Win32 I got the following:
> > after a call to "ACE_OS::close(pipe[1]);", the testEcho is closed
> >immidiately and the output is :
> >TestEcho started
> >StdOut:aa
> >StdErr:aa
> >
> >But when I run this code on Linux, testEcho is never terminated,
and
> >the output is only:
> >TestEcho started
> >
> >Please help.
> 
> 
> -- 
> Dr. Douglas C. Schmidt                       Professor and 
> Associate Chair
> Electrical Engineering and Computer Science  TEL: (615) 343-8197
> Vanderbilt University                        WEB: 
> www.dre.vanderbilt.edu/~schmidt
> Nashville, TN 37203                          NET: 
> d.schmidt at vanderbilt.edu
> 
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
> 




More information about the Ace-users mailing list