Reputation: 41
I have written a java app which manipultes a file which is created by another program. i want my program to work in real time, in order to do so, i need to read from a file while the other program is writing it. the simple solution is to keep reading from the file even when EOF has been reached in an infinite loop, but thats very ineffecient.
the better solution is to use a named pipe and configure the program to write to that pipe (i can choose the output file of the program). I know nothing about pipes in windows and i have no idea how to create them in the filesystem. if possible, i would like to create them from my app (in java), but any other way will be good as well.
i am working in windows xp SP3.
is it even possible in windows? and what is the best way?
thanks, Yannay
Upvotes: 4
Views: 2123
Reputation: 8222
While windows has pipes they aren't completely the same as those under *nix (see this wikipedia page) and there is no support in Java. The common suggestion is instead to use a socket for interprocess communication. Though I can not provide any hard evidence, if you are running through the localhost this should not create a significant amount of overhead versus a pipe, and will also allow your code to be more flexible if you later choose to run the processes on different machines.
Upvotes: 1