[Ace-users] [ace-users] problems linking streams

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Wed Oct 17 18:46:43 CDT 2007


Hi Wasili,
   
   Thanks for using the PRF.

>    ACE VERSION: 5.6
>
>    HOST MACHINE and OPERATING SYSTEM:
>        Windows XP
>
>    COMPILER NAME AND VERSION (AND PATCHLEVEL):
>       VC 8
>
>    THE $ACE_ROOT/ace/config.h FILE
>        #include "ace/config-win32.h"
>
>    AREA/CLASS/EXAMPLE AFFECTED:
>       ACE_Stream::link()
>
>     SYNOPSIS:
>       messages passed into a linked stream does not get processed by 
>its modules      
>
>    DESCRIPTION:
>       I wrote a module containing a file reading and a file writing 
>task and another wich acts as echo module by passing the messages back 
>to its sibling down the stream.
>       This works as long as these two modules are part of the same 
>ACE_Stream instance, but when I split this modules to two streams and 
>link them together, the messages of the first are not passed to the 
>second module.
>
>
>
>int ACE_TMAIN ( int argc, ACE_TCHAR *argv[] )
>{
>  ACE_TRACE( ACE_TEXT("ACE_TMAIN\n") );
>
>  ACE_Stream<ACE_MT_SYNCH> *fileIOStream = new ACE_Stream<ACE_MT_SYNCH>();
>  IO_Posix_InOut_Module    *inout_module = new 
>IO_Posix_InOut_Module(argv[0],
>    
>"--io_posix_out_task_file=D:/Projects/privat/WeatherBox/libs/io/posix/streams/tests/io/io_posix_stream_test.out 
>"
>    
>"--io_posix_in_task_file=D:/Projects/privat/WeatherBox/libs/io/posix/tasks/tests/in/io.posix.in.task.test.txt");
>  ModuleBridge_Module      *module_bridge = new ModuleBridge_Module();
>
>  ACE_Stream<ACE_MT_SYNCH> *echoStream   = new ACE_Stream<ACE_MT_SYNCH>();
>  echoStream->push(module_bridge);
>  fileIOStream->link(*echoStream);
>  fileIOStream->push(inout_module);
>
>/*
>  fileIOStream->push(module_bridge);
>  fileIOStream->push(inout_module);
>*/
> 
>  fileIOStream->wait();
>  return 0;
>}
>
>
>    REPEAT BY:
>
>I debuged the application and find out, that some default modules 
>containing ACE_Stream_Head and ACE_Stream_Tail tasks are created and 
>pushed into the streams and
>my message is processed by the ACE_Stream_Tail instance.
>I tryied to replace the tail module with my one, but this seems not to 
>work, because my messages are still processed by an ACE_Stream_Tail 
>instance.
>
>int ACE_TMAIN ( int argc, ACE_TCHAR *argv[] )
>{
>  ACE_TRACE( ACE_TEXT("ACE_TMAIN\n") );
>
>  ACE_Stream<ACE_MT_SYNCH> *fileIOStream = new ACE_Stream<ACE_MT_SYNCH>();
>  IO_Posix_InOut_Module    *inout_module = new 
>IO_Posix_InOut_Module(argv[0],
>    
>"--io_posix_out_task_file=D:/Projects/privat/WeatherBox/libs/io/posix/streams/tests/io/io_posix_stream_test.out 
>"
>    
>"--io_posix_in_task_file=D:/Projects/privat/WeatherBox/libs/io/posix/tasks/tests/in/io.posix.in.task.test.txt");
>  ModuleBridge_Module      *module_bridge = new ModuleBridge_Module();
>
>  ACE_Stream<ACE_MT_SYNCH> *echoStream   = new ACE_Stream<ACE_MT_SYNCH>();
> 
>  echoStream->replace(echoStream->tail()->name(), module_bridge);
>  fileIOStream->link(*echoStream);
>  fileIOStream->push(inout_module);
>
>/*
>  fileIOStream->push(module_bridge);
>  fileIOStream->push(inout_module);
>*/
> 
>  fileIOStream->wait();
>  return 0;
>}
>
>
>
>Is it possible to get messages passed across linked streams?

I recommend you check out the ACE_UPIPE_Acceptor and ACE_UPIPE_Stream
classes, which are in ACE_ROOT/ace/, the test in
ACE_ROOT/tests/UPIPE_SAP_Test.cpp, and the various examples in
ACE_ROOT/examples/IPC_SAP/UPIPE_SAP/.

Thanks,

        Doug
-- 
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



More information about the Ace-users mailing list