Created On:  31 October 2012

Problem:

Product: VisiBroker 8.5
Platform: All

How do you send/receive CORBA_OctetSequence data between VisiBroker for C CORBA client and server?

Resolution:

An example for this scenario is attached to the article. This example is based on /examples/vbroker/basic/bank_agent. Please refer it for compiling the attached example.

In this example, the GetFileContent() CORBA method will return the CORBA_OctetSequence data. This has been configured in Bank.idl.

The server reads a file, composes an CORBA_OctetSequence and send it as a reply to the GetFileContent() method.

The client receives the CORBA_OctetSequence and prints the data.

The below is the OctetSequence constructor for your reference:

CORBA_OctetSequence::CORBA_OctetSequence(::CORBA::ULong _max,
                                         ::CORBA::ULong _len,
                                         ::CORBA::Octet *_data,
                                         ::CORBA::Boolean _release)
 
The "release" flag in the CORBA_OctetSequence constructor indicates whether the destructor of the CORBA_OctetSequence should delete the memory of "_data".
 
Setting to 0 means the application logic will delete the memory of "_data". i.e. the application will manage the destruction of the memory to avoid memory leak when it is safe to do so.

Setting to 1 means the ORB will delete the memory of "_data" in the destructor of the CORBA_OctetSequence after marshalling the data.

Incident #2586685