Oleg Vazhnev
Oleg Vazhnev

Reputation: 24067

how to pass some "statistics" from c# program to another program?

I have command-line program that "do a lot of work" and produce "a lot of statistics". It's stocks trading software pretty critical to delays, bugs, and whatever, so I don't want to add GUI to it. (moreover GUI is required sometimes, but console application should be always launched)

I need GUI to friendly display collected statistic (in read-only mode). How to transfer that statistics? It would be enough to refresh it every second. I need to transfer bunch of data from one console c# program to another GUI (probably not c#) program, in future probably by network, but locally for now.

Statistics is like "sensors data", measured every second. There are a lot of (hundreds) of sensors. (in real word it's a lot of different values, like "profit", "orders per second" etc.)

Should I use plain file, db or someting else and how?

Upvotes: 2

Views: 259

Answers (5)

Arthur P
Arthur P

Reputation: 1060

This is going way beyond a single comment of course. What you will eventually need is a dispatching mechanism to notify subscribers about the data record update. Since the amount of data is huge, you might not want to opt for a persistence storage. If the dispatching to multiple subscribers looks overwhelming so far, you can go with a simple interproc (via shared object (aka named pipes) for the consumer-provider to be on the same machine or something more distributed otherwise)

Upvotes: 0

Jeffrey Kevin Pry
Jeffrey Kevin Pry

Reputation: 3296

You can try to use a database with a queuing system or a messaging appliance. A server can receive messages to a queue and then the GUI can "subscribe" to the messages.

Microsoft Message Queuing

Also you can take a look at memory mapped files:

Memory-mapped file

These can be shared amongst applications simultaneously when configured properly.

Hope that helps,

Jeffrey Kevin Pry

Upvotes: 2

user195488
user195488

Reputation:

I suggest you look at a technology like DDS. There are no databases involved and it is not hard to implement. I began looking at OpenSplice DDS recently. There are a number of different implementations out there.

Upvotes: 1

Kinexus
Kinexus

Reputation: 12904

It would probably be more efficient and resilient to have the 'server' store it's information within a Database and have the 'client' poll this as and when required.

Upvotes: 1

Stephen Cleary
Stephen Cleary

Reputation: 456587

You can use any form of IPC (inter-process communication).

Since you're planning to go over the network in the future, I recommend WCF. If the GUI program isn't .NET, then you may need to use a lower-level solution, such as named pipes or sockets.

Upvotes: 5

Related Questions