Question

I have a situation where i need to send commands to a running java application, now i am using tcp/ip socket to send commands to the application using a internet explorer context menu item. But as soon as the application starts virus scanners complain that the application started listening, although i am only listening for local connections. I think this may be confusing to the users. I am looking at others ways of communicating without pissing off av scanners?

Was it helpful?

Solution

For this, you're best off a file based FIFO queue. Or using Java Native Access/Java Native Interface to write to a NamedPipe or Shared Memory. If you go the JNA/JNI route, you could create a Named Event.

But there's probably no way to do what you want, with any amount of efficiency without going the JNA/JNI route.

OTHER TIPS

You can use Java Management Extentions (JMX) to expose methods in a running process through a simple web interface.

Sockets are pretty much the traditional way of doing IPC, but if you really want to avoid them, you might be able to come up with a workaround using the local filesystem. You wouldn't want to use standard file reads/writes, since you would most likely want to effectively implement a queue in the filesystem.

If I were going to implement IPC through the filesystem, I'd probably use SQLite (which can be threadsafe when compiled so) and have one table for each listener. I'd probably use a single-column table to insert the message, and the listener would just pull out the row with the lowest rowid, then delete said row.

But my approach is not at all Java-specific, so there might be better ways to do that using Java (such as @darthcoder's response).

A lot of folks use something like JMS in this scenario.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top