If I control both applications, what is the best way to communicate between 2 exe's written in VB.Net. For example, I want to drop an XML file from one app, and pick it up with the other, but I do not want poll for the file. I've heard of named pipes, but I found it was complicated. What's the most effecient way to do this?
+3
A:
You don't have to poll for the file. Use a FileSystemWatcher.
ElectricDialect
2010-04-10 21:42:53
+1 - beat me to it!
SB
2010-04-10 21:43:55
I've read that the FileSystemWatcher is not always reliable and you can sometimes lose some changes. If you go this route you might still want to poll occasionally to make sure you haven't missed something. Source: http://stackoverflow.com/questions/239988/filesystemwatcher-vs-polling-to-watch-for-changes
Mark Byers
2010-04-10 21:47:24
Something built on the FileSystemWatcher could have problems with race conditions. It might still be the simplest solution but @ajl be sure to come up with something to avoid this. Perhaps use a ".partial" file extension on XML files that are still being written by the first program and the second program could avoid files with that extension.
Brian Ensink
2010-04-10 21:53:38
+3
A:
The easiest way is probably to use Windows Communication Foundation. This article has example code written in VB.NET.
Mark Byers
2010-04-10 21:44:08
+2
A:
One simple way would be to use WCF. The receiver application could host a simple WCF service, and the sender could send the file to it.
John Saunders
2010-04-10 21:44:07
A:
.NET 4 includes support for memory-mapped files. With these you may even eschew the need to use the filesystem. However, if the processes are not running on the same machine, you'll have to use some other approach (as mentioned by others, WCF would be a good one).
Martinho Fernandes
2010-04-10 21:49:19