I have a fairly awkward setup here, and IPC via Named Pipes seems to be the best way to solve it. FIrst I'll take a moment to explain my setup:
A 3rd party program generates lines of text in realtime (where they come from doesn't matter).
That 3rd party program has allowed me to write a DLL Plugin to capture those lines of text for my own use.
I am writing a very complex program to use those lines of text for various purposes, which are beyond the scope of the problem.
The problem I have is getting the lines of text from my DLL, to my Program (two seperate projects). The 3rd Party App only recognizes DLL's written in VB.Net.
My initial attempt uses a system of two log files to transfer text back and forth. My DLL opens/writes/closes the temp log file each time a line comes through, and my Program reads the log file on a 2 second timer, copies tis contents to a permanent log file and erases the temp. This is, as I'm sure you can tell, a HUGE amount of overhead. I need this to stay as real-time as possible (no buffering), and the load the DLL is under could be several dozen lines per second. It is possible (and has happened) for the Program to attempt to read the temp log at the same moment the DLL is writing to it - this causes a crash in the main program.... (I can write a 'test' loop to make sure it's readable, but that still may not solve things perfectly)
Anyway, to reduce overhead and speed things up, i'm looking into IPC via Named Pipes. The MSDN example of Named Pipes (after some tweaking of their bugs), works well enough but they don't document very well what they are doing, and the important parts aren't documented at all (namely, what the heck they're doing with the data being transferred, there's two Mod ops on them and the resulting data at the client end is not recognizable, so I can't tell how it came across)
I would like to transfer my data in Strings over the named pipe -- is this possible without converting the string to bytes and back again? I attempted a conversion of string->byte, transfer, byte-> string but the client-side conversion resulted in garbage...
If I could get some help on either transferring via String, or properly converting String to ByteArray and back again, I would greatly appreciate it!
A 3rd party program generates lines of text in realtime (where they come from doesn't matter).
That 3rd party program has allowed me to write a DLL Plugin to capture those lines of text for my own use.
I am writing a very complex program to use those lines of text for various purposes, which are beyond the scope of the problem.
The problem I have is getting the lines of text from my DLL, to my Program (two seperate projects). The 3rd Party App only recognizes DLL's written in VB.Net.
My initial attempt uses a system of two log files to transfer text back and forth. My DLL opens/writes/closes the temp log file each time a line comes through, and my Program reads the log file on a 2 second timer, copies tis contents to a permanent log file and erases the temp. This is, as I'm sure you can tell, a HUGE amount of overhead. I need this to stay as real-time as possible (no buffering), and the load the DLL is under could be several dozen lines per second. It is possible (and has happened) for the Program to attempt to read the temp log at the same moment the DLL is writing to it - this causes a crash in the main program.... (I can write a 'test' loop to make sure it's readable, but that still may not solve things perfectly)
Anyway, to reduce overhead and speed things up, i'm looking into IPC via Named Pipes. The MSDN example of Named Pipes (after some tweaking of their bugs), works well enough but they don't document very well what they are doing, and the important parts aren't documented at all (namely, what the heck they're doing with the data being transferred, there's two Mod ops on them and the resulting data at the client end is not recognizable, so I can't tell how it came across)
I would like to transfer my data in Strings over the named pipe -- is this possible without converting the string to bytes and back again? I attempted a conversion of string->byte, transfer, byte-> string but the client-side conversion resulted in garbage...
If I could get some help on either transferring via String, or properly converting String to ByteArray and back again, I would greatly appreciate it!