Frederick Grumieaux
2011-06-09 20:10:48 UTC
Hi everyone,
I can't change the max message size with the options field in the CORBA::ORB_init() function.
There is only one function in my program that would require big messages and I want to change the max message size programmatory when I would call this function and keep it on the default size otherwise. I found out that the parameter which handles this stuff is named "giopMaxMsgSize" and that it can be read by calling "omniORB::giopMaxMsgSize()". This is however a read parameter and I couldn't find where to set it, until I stumbled upon this site https://idlebox.net/2007/apidocs/omniORB-4.1.0.zip/omniORB/omniORB004.html and discovered that I already implemented 3 other parameters just like it, which seem to work. (verifyObjectExistsAndType, strictIIOP and oneCallPerConnection ).
Unfortunately tough it didn't work.
So I am now hoping that someone of you could tell me how to do it. The code I use can be found below.
This is how the init function is implemented:
extern "C" __declspec (dllexport) void SL_Init(int eid,char* corbaloc,char** errorMessage)
{
DCM::DeviceControl_ptr dcm = NULL;
CORBA::ORB_ptr orb = NULL;
try
{
//make this function 'thread safe' with other threads using mapORB and mapDCM
AutoLock LockORB(mapORB_Lock);
AutoLock LockDCM(mapDCM_Lock);
//to be sure that the program is initialized: call the init function from the program initializer
MyProgIni.Init();
//Close if still opened (restart)
ReleaseLinks(eid);
if(mapORB.find(eid) == mapORB.end())
{
const char* options[][2] =
{
{ "verifyObjectExistsAndType", "0" },
//{"traceLevel","100"},
{"strictIIOP","0"},
{"oneCallPerConnection","0"},
{"giopMaxMsgSize","20971520"},//change the max message size to 20MB -> to allow big files for the backup functionality
{ 0, 0 }
};
int argc = 0;
char* argv = NULL;
orb = CORBA::ORB_init(argc,&argv,"omniORB4",options);
mapORB[eid] = orb;
//delete[] options;
}
if(mapDCM.find(eid) == mapDCM.end())
{
CORBA::Object_var obj = orb->string_to_object(corbaloc);
dcm = DCM::DeviceControl::_unchecked_narrow(obj);
mapDCM[eid] = dcm;
CORBA::Long clientNumber;
dcm->LogOn(
DCM::DeviceControl::Client_Gui,
IIOP.LoginName(),
IIOP.PassWord(),
"",
clientNumber);
}
*errorMessage = (char*)CoTaskMemAlloc(strlen(" ")+1);
strcpy(*errorMessage," ");
}catch(...)
{
*errorMessage = (char*)CoTaskMemAlloc(strlen("unexpected error in login")+1);
strcpy(*errorMessage,"unexpected error in login");
ReleaseLinks(eid, orb, dcm);
}
}
This is where I want to use it and according to the response I get on this the size is still 2Mb (default ) - the "MARSHAL" exception occurs when calling "dcm->BackupSettings2(scope, output);"
void BackupSettings2(DCM::DeviceControl_ptr dcm, CORBA::UShort scope, unsigned char** byteStream, unsigned long* length, char** Progress)
{
*Progress = (char*)CoTaskMemAlloc(5000);
sprintf(*Progress,"Start\n(Max message size = %lu )\n", omniORB::giopMaxMsgSize());
*length = 0; //no memory allocated (yet)
DCM::DeviceControl::ByteStream_var stream;
dc::ByteStream_out output(stream.out());
strcat(*Progress, "stream var created\n");
dcm->BackupSettings2(scope, output);
strcat(*Progress, "Data retrieved from device.\n");
/*other code*/
return;
}
Thanks in advance,
Frederick G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20110609/3db63f1f/attachment-0001.htm
I can't change the max message size with the options field in the CORBA::ORB_init() function.
There is only one function in my program that would require big messages and I want to change the max message size programmatory when I would call this function and keep it on the default size otherwise. I found out that the parameter which handles this stuff is named "giopMaxMsgSize" and that it can be read by calling "omniORB::giopMaxMsgSize()". This is however a read parameter and I couldn't find where to set it, until I stumbled upon this site https://idlebox.net/2007/apidocs/omniORB-4.1.0.zip/omniORB/omniORB004.html and discovered that I already implemented 3 other parameters just like it, which seem to work. (verifyObjectExistsAndType, strictIIOP and oneCallPerConnection ).
Unfortunately tough it didn't work.
So I am now hoping that someone of you could tell me how to do it. The code I use can be found below.
This is how the init function is implemented:
extern "C" __declspec (dllexport) void SL_Init(int eid,char* corbaloc,char** errorMessage)
{
DCM::DeviceControl_ptr dcm = NULL;
CORBA::ORB_ptr orb = NULL;
try
{
//make this function 'thread safe' with other threads using mapORB and mapDCM
AutoLock LockORB(mapORB_Lock);
AutoLock LockDCM(mapDCM_Lock);
//to be sure that the program is initialized: call the init function from the program initializer
MyProgIni.Init();
//Close if still opened (restart)
ReleaseLinks(eid);
if(mapORB.find(eid) == mapORB.end())
{
const char* options[][2] =
{
{ "verifyObjectExistsAndType", "0" },
//{"traceLevel","100"},
{"strictIIOP","0"},
{"oneCallPerConnection","0"},
{"giopMaxMsgSize","20971520"},//change the max message size to 20MB -> to allow big files for the backup functionality
{ 0, 0 }
};
int argc = 0;
char* argv = NULL;
orb = CORBA::ORB_init(argc,&argv,"omniORB4",options);
mapORB[eid] = orb;
//delete[] options;
}
if(mapDCM.find(eid) == mapDCM.end())
{
CORBA::Object_var obj = orb->string_to_object(corbaloc);
dcm = DCM::DeviceControl::_unchecked_narrow(obj);
mapDCM[eid] = dcm;
CORBA::Long clientNumber;
dcm->LogOn(
DCM::DeviceControl::Client_Gui,
IIOP.LoginName(),
IIOP.PassWord(),
"",
clientNumber);
}
*errorMessage = (char*)CoTaskMemAlloc(strlen(" ")+1);
strcpy(*errorMessage," ");
}catch(...)
{
*errorMessage = (char*)CoTaskMemAlloc(strlen("unexpected error in login")+1);
strcpy(*errorMessage,"unexpected error in login");
ReleaseLinks(eid, orb, dcm);
}
}
This is where I want to use it and according to the response I get on this the size is still 2Mb (default ) - the "MARSHAL" exception occurs when calling "dcm->BackupSettings2(scope, output);"
void BackupSettings2(DCM::DeviceControl_ptr dcm, CORBA::UShort scope, unsigned char** byteStream, unsigned long* length, char** Progress)
{
*Progress = (char*)CoTaskMemAlloc(5000);
sprintf(*Progress,"Start\n(Max message size = %lu )\n", omniORB::giopMaxMsgSize());
*length = 0; //no memory allocated (yet)
DCM::DeviceControl::ByteStream_var stream;
dc::ByteStream_out output(stream.out());
strcat(*Progress, "stream var created\n");
dcm->BackupSettings2(scope, output);
strcat(*Progress, "Data retrieved from device.\n");
/*other code*/
return;
}
Thanks in advance,
Frederick G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20110609/3db63f1f/attachment-0001.htm