Processes signaling is missing ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to use some kind of signaling among processes, but the only thing I
found that can something like that is the Mutex.

But the Mutex doesn’t have a real signaling, it only has Wait() and
Release(), the trouble is that the Wait returns not only if the Mutex is
released, but also if I’m the only one who created it or the only one that
has it, and that is not good for me.

I need to know if the other process signaled or not, regardless if he’s
running and if created it.

In C/C++ I could use the events, but in .NET is seems that the
AutoResetEvent and MnualResetEvent are for use among threads and not process.


Can anybody have an Idea how can I do that?
 
Hi Sharon,

Thanks for your post.

Yes, currently in .Net, there is few build-in support for doing
inter-process communication, we still have to resort to old Win32 ways to
get this done.

In Win32 world, there are a lots of ways to do inter-process communication.
For example, if your applications have UI, we can p/invoke
RegisterWindowMessage to register a system-wide customized message, then 2
applications send/post this message to communicate with each other.(Note:
we can listen this message with overriding Form.WndProc method)
Below is the C++ code to do this, but it should not be hard to convert it
to C# p/invoke code:
http://www.codeguru.com/vb/gen/vb_system/win32/article.php/c7401/

Also, we may use WM_COPYDATA message to do the communication. Below is
another C++ article(sorry I can not find any good article on C#):
http://www.codeproject.com/threads/ipc_wmcopy.asp

Further more, if your applications do not have UI, we can not rely on
windows messages. Then we can use other inter-process communication
technologies, such as Named Pipe, Memory Mapped file etc.., please refer to
the articles below:
"Inter-Process Communication in .NET Using Named Pipes, Part 1"
http://www.codeproject.com/csharp/DotNetNamedPipesPart1.asp
"A C# Framework for Interprocess Synchronization and Communication"
http://www.codeproject.com/csharp/csthreadmsg.asp

Finally, the .Net way of doing inter-process communication is .Net
Remoting, you can find a lot of articles on .Net Remoting in MSDN or
google.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Sharon said:
I need to use some kind of signaling among processes, but the only thing I
found that can something like that is the Mutex.

But the Mutex doesn’t have a real signaling, it only has Wait() and
Release(), the trouble is that the Wait returns not only if the Mutex is
released, but also if I’m the only one who created it or the only one
that
has it, and that is not good for me.

I need to know if the other process signaled or not, regardless if he’s
running and if created it.

In C/C++ I could use the events, but in .NET is seems that the
AutoResetEvent and MnualResetEvent are for use among threads and not
process.


Can anybody have an Idea how can I do that?
Yep, PInvoke the CreateEvent, OpenEvent, ResetEvent, SetEvent, CloseHandle
Win32 API's, or wait for v2.0 of the framework and use the EventWaitHandle
class.

Willy.
 
Hi Sharon,

Does our replies make sense to you? If you still have any concern, please
feel free to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Back
Top