justinstenning / SharedMemory

C# shared memory classes for sharing data between processes (Array, Buffer and Circular Buffer)
https://www.nuget.org/packages/SharedMemory
Other
566 stars 118 forks source link

Broadcasting data using SharedMemory #70

Open ekalchev opened 8 months ago

ekalchev commented 8 months ago

I am looking for advice how to implement the following functionality with SharedMemory

I have N number of processes and I would like any of those N processes to broadcast data to other N-1 processes. I looked at the code and it seems this is not supported out of the box. I am looking how to implement that utilizing SharedMemory classes. One possible solution is every process to have CircularBuffer with unique name. On start, every process will register the name of his Circular buffer on my own implementation of Memory Mapped file that will act as registry for the active processes. When a process need to broadcast data, he will first read the memory mapped file with the regirations and they will construct many circular buffers using the registration names and then will send the data to each buffer.

Is there easier way to do that using SharedMemory?