Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
330 views
in Technique[技术] by (71.8m points)

.net - What is the best mechanism for communicating cross-process in Windows CE?

I need to broadcast an event that can be picked up by any application running on a Windows CE 5 device.

Haven't done this before so i'd be interested in knowing what techniques people would suggest to see if there is anything i've not considered.

All of the applications that need to receive this event are .NET Compact Framework based so "managed-only" solutions can be considered.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I swear I've answered this somewhere - here, newsgroups, blog, something - but I can't find it, so here it is again:

You really have 4 options for IPC under Windows CE. I'll focus on CF solutions here.

  1. Use a socket. This is a pain as the event source kind of needs to know about the sink's exxistence. It's certainly my least-favorite option, and I use it close to never.
  2. A named system event (a-la the CreateEvent API). This works for a simple boolean-type event like "this is on." CE is nice in that you can also associate a 32-bit value with the event (SetEventData). For a managed implementation, see this blog entry (the actual class is in the SDF).
  3. A Memory Mapped File. The SDF has an implementation that I've used in a couple customer projects, so it's pretty well tested. Someday I should do a blog post on how to use it, but you're smart and can likely figure it out from the docs.
  4. Point-to-point message queues. These are CE-specific, but way cool. The kernel uses them for a lot of system stuff. They are very fast and robust. Again, the SDF has an implementation. MSDN has an article on usage, but bear in mind the MSDN code has some bugs in it that the SDF has fixed.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...