Anne
Anne

Reputation: 189

communicating Java application and C++ process using posix ipc message queues

It's quite difficult for me to explain what I need to implement, so I really hope I am able to do it.

I have a C process which uses an ipc message queue to send and receive data. I also have a Java application which needs to send and received messages to/from that C process, so it needs access to that queue.

I've been searching for a way to do this and I think JNA (java natice access) could be a solution. The problem is that, apparently, I need a DLL so I can map and use the methods I need (msgget, msgsnd,msgrcv,msgctl), but I don't know which DLL I should load. I'm quite new at this so I'm feeling lost.

Is there another way to get these two applications to communicate using message queues? Or is JNA a good solution and I only need to find the correct DLL to load?

Thanks in advance.

Upvotes: 2

Views: 3004

Answers (3)

John Smith
John Smith

Reputation: 2332

If that is an option, you could change the C process to use a different way of communication. In my experiences Sockets are the least troublesome way of communicating between c and java programs/processes.

Upvotes: 1

victorsavu3
victorsavu3

Reputation: 195

If you can find depend.exe (I know VS 2005 has it), it can show you the functions each dll exports. Run it on your c program to see where the functions are coming from, if they are real you can use JNA. The functions might actually be just wrappers and if so you need to use JNI

Upvotes: 0

Filipe Fedalto
Filipe Fedalto

Reputation: 2540

The use of JNA is perfectly legal, but somehow tricky.

This post "Java POSIX IPC" may have some clues as to how to do that in Java or using Java Libraries.

Upvotes: 0

Related Questions