lakoon
29th June 2007, 18:49
Hello

I'm just struggling with the *.message IPC commands. In a BaanIV c4 Windows environment.

So far I have a script wich works fine to receive message in a mailslot queue which i have created from baan side.

If I try to open a mailslot queue from baan side which was created from an outside process with the following command, I get return value -1 and e = 0.
m2.id = open.message(1, "mailbox", 2)

Then I tried the following:
m2.id = open.message(1, "mailbox", 0)
I get a return value -1 and e = 17 what means that the mailslot queue already exists and is used by a process.

So, how can I connect to that queue to send information to the outside process?

Any idea would really help...

/lakoon

george7a
5th July 2007, 14:38
Hi,

The following links might be helpful:
http://www.baanboard.com/baanboard/showpost.php?p=78467&postcount=3
http://www.baanboard.com/baanboard/showpost.php?p=50973&postcount=6
http://www.baanboard.com/baanboard/showthread.php?t=5365&highlight=open.message

- George

lakoon
9th July 2007, 10:38
Hello,

Thank you for your reply. I did look at this threads already. They gave me some hints, but not really solved the problme.

What I have found so far:
If you create a new mailslot within Baan you can see the created file in the open Files list of the process. Lets say I create the mailslot "mailout" with the command
m2.id = open.message(1, "mailbox", 2)
the system will create a mailslot file in the memory with the name:
\\mail\Device\mailbox1
Baan always puts the project number behind the mailboxname.
So an external process has to connect to the mailboxname mailbox1 with the mailslots commands. For C++ it looks like below:

#define g_szMailslot "\\\\.\\mailslot\\mailbox1"
#define BUFFER_SIZE 1024 //1k

int main(int argc, char* argv[])
{
HANDLE hMailslot;
hMailslot = CreateMailslot(
g_szMailslot, // mailslot name
BUFFER_SIZE, // input buffer size
MAILSLOT_WAIT_FOREVER, // no timeout
NULL); // default security attribute

if (INVALID_HANDLE_VALUE == hMailslot)
{
printf("\nError occurred while creating the mailslot: %d", GetLastError());
return 1; //Error
}
else
{
printf("\nCreateMailslot() was successful.");
}
....

But although the queue has the same name baan can not connect to it!

Connections from one bshell process to another bshell process of a different user working wihtout any problem.

May somebody else has a good hint

/lakoon