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

Wasilios Goutas wasili at goutas.de
Sat Oct 20 17:01:07 CDT 2007


Hi,

I checked the ACE_UPIPE_Stream examples.
I noticed, that there is no interface to manipulate the ACE_Stream 
menber of an ACE_UPIPE_Stream instance, so pushing own modules into it 
seems not possible.
I updated my source based on ACE_ROOT/tests/UPIPE_SAP_Test.cpp and 
tryied to send the message of my file reader stream across the 
ACE_UPIPE_Stream instance but I'm not able to get the message out of my 
stream using its get() method.

  ACE_UPIPE_Stream c_stream;
  ACE_UPIPE_Connector con;

  if (con.connect (c_stream, addr) == -1)
    ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connector ACE_UPIPE_Connector failed\n")));

  ACE_Stream<ACE_MT_SYNCH> *fileIOStream = new ACE_Stream<ACE_MT_SYNCH>();
  ...
  fileIOStream->push(inout_module);
  ...
  if ( 0 > fileIOStream->get(mb) )
  ...      ^^^^^^^^^^^^^^^^^^^^
           this call never returns

  if ( 0 > c_stream.send (mb) )
  ...


The message is passed again to the ACE_Stream_Tail instance which is logical.
Is there a way to get a message of a writer task out of the stream, or is there a way to push modules to the stream_ instance of an ACE_UPIPE_Stream?

I still try to concatenate multiple streams to be able to test easily different module combinations, it seems that I should rethink my test szenarios:-)

Thank for your help and for this great framework.

bye
Wasili
 






Douglas C. Schmidt schrieb:
> 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
>   



More information about the Ace-users mailing list