interprocesscommunication

  • Thread starter Thread starter TonyJ
  • Start date Start date
T

TonyJ

Hello!

Assume I have several exe files running and all these constitute the actual
application.

To be able to log errors and different types of trace my intention is to
have a separate exe file that take care of the actual writing to a file.
Between the exe files(application) and the exe file that is handle the
writing of errors and trace my intention is to use interprocess
communication.
I have used interprocesscommunication when I worked with C++ but not in C#.

Now I wonder can anybody give me a hint about where to find some example
about which classes and so on to use for this matter.

By the way is interprocesscommunication the best way to send message between
processes when working with C#.


//Tony
 
By the way, why are you building all these separate executables? Why don't
you just build a main class that has the application entry point, and
several class libraries (DLLs) that you can reference? Then you won't need
all this IPC stuff.

Is there some reason that they must be running in separate executable
assemblies? Do they have to run on separate machines, for instance?

Maybe you're just worried about making sure that all the other classes all
use the same instance of your error handling class, for some reason? If so,
just pass a reference to it to its clients.


Peter
 
TonyJ said:
Hello!

Assume I have several exe files running and all these constitute the
actual
application.

To be able to log errors and different types of trace my intention is to
have a separate exe file that take care of the actual writing to a file.
Between the exe files(application) and the exe file that is handle the
writing of errors and trace my intention is to use interprocess
communication.
I have used interprocesscommunication when I worked with C++ but not in
C#.

Now I wonder can anybody give me a hint about where to find some example
about which classes and so on to use for this matter.

By the way is interprocesscommunication the best way to send message
between
processes when working with C#.

Interprocess Communications is a very generic term, any method for passing
messages between processes qualifies. There are many implementations of IPC
including pipes, sockets, shared memory, RPC, mailslots, and filesystem
polling, just to name a few.

For what you describe, a mailslot or datagram socket would be suitable. But
maybe you should just use the existing standard (syslog).
 
Hello!!

I just wonder about one thing. Assume I have one main and several dll as you
mentioned and I open a dialog in one dll and
then I want to close down the executable(exe.-file)
How is this done?

//Tony
 
It's unusual to want to close the form associated with the main executable,
but if you must close that form then there are several ways of doing it.
Probably the simplest way is to hide it. You can do this from any of your
other forms as long as they have access to a reference to your "main" form.
To ensure they do have a reference you could provide them each with a
constructor that takes a reference to the main form (plus any other
parameters you may need to pass in).

So, when your main form opens a dialog it could say:

MyDialog md = new MyDialog(this);
md.Show(); // or md.Visible = false;

Then in the dialog constructor, you can say:

public class MyDialog : Form // or whatever
{
private MainForm mf;

public MyDialog(MainForm mf)
{
// other constructor stuff
this.mf = mf;
mf.Visible = false; // Hide the main form or mf.Hide();
// other constructor stuff
}

...

}

HTH


Peter
 
Hello!


If I want to have good performance for being able to get message from all
the different exe files and then write these message down to a file
which one should I then use for IPC.

//Tony
 
TonyJ said:
Hello!


If I want to have good performance for being able to get message from all
the different exe files and then write these message down to a file
which one should I then use for IPC.

//Tony

Take a look at the System.Runtime.Remoting namespace in V2 or System.ServiceModel in V3
(WCF) .

With System.Remoting (V2), the best performance can be obtained when using IpcServerChannel
(namespace System.Runtime.Remoting.Channels.Ipc), which uses named pipes under the covers.
WCF offers the NetNamedPipeBinding which uses shared memory under the covers.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error Installing "ADAPTEC EZCD 4.04" 1
Installation of a C# .Net 2003 Application 4
application domain 6
.exe file with C# 9
More about application domain 1
Runtime version 1
ngen 12
C++ <-> C# communication 1

Back
Top