473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Event between 2 processes

Hi,

I need a possibility to fire an event in one process and react in another
process.

can anybody help me ?

Martin
Jul 2 '08 #1
6 2062
Martin Priebe wrote:
Hi,

I need a possibility to fire an event in one process and react in another
process.

can anybody help me ?

Martin

Depends on how low level you want to go. You can use any of the
following (Generally falls under "InterProcess communication" - you may
want to Goggle that up:

1). Named Pipes
2). Shared memory (assuming both processes are on the same physical
machine - otherwise it gets slightly more complicated)
3). Windows (or another form of) messaging

HTH
Jul 2 '08 #2
On Wed, 02 Jul 2008 00:43:05 -0700, Martin Priebe
<ma***********@hermos.comwrote:
I need a possibility to fire an event in one process and react in another
process.

can anybody help me ?
Chances are, yes.

But your question is very vague. The basic requirement is that you will
have to implement yourself some kind of inter-process communication. The
C#/.NET event model doesn't support this implicitly. But once you have
the IPC working, it should be simple enough to create an event in one
process that is raised in response to communications received from another
process.

Pete
Jul 2 '08 #3
okay ..

i use shared memory to transfer a bitmap from one process to the second
process.
it works.

but i have 2 problems.

first:
process one have to signalize "ready" - so process 2 can read out the shared
memory.

second:
i need to signalize "ready" + meta-data. (length of the byte-array)
when i use Win API CreateEvent and OpenEvent - it works.
But i canīt transfer any information with it.

greeting and thx
Martin
Jul 2 '08 #4
Martin Priebe wrote:
okay ..

i use shared memory to transfer a bitmap from one process to the second
process.
it works.

but i have 2 problems.

first:
process one have to signalize "ready" - so process 2 can read out the shared
memory.

second:
i need to signalize "ready" + meta-data. (length of the byte-array)
when i use Win API CreateEvent and OpenEvent - it works.
But i canīt transfer any information with it.

greeting and thx
Martin

Sounds like you would have been better of using Windows messaging, since
that is more in line with the event-driven paradigm you appear to be
describing. For windows messaging, (assuming you had client/server and
not P2P model), you would create an invisble window in the client and
you simply send the data to the client from the publisher, when the data
is available. Small caveat, the size of the data payload is fixed (i.e.
cannot be changed), so your best bet would be to specify the size of the
largest image you expect to send, alternatively, you could incorporate
meta data in the payload, which allows you to split it into several
'packets' and then reassemble at the client side.

With shmem (shared memory), you need to set aside a portion of the
memory where your sender writes the status (ready, etc) as well as any
metadata. The client will have to continously poll this section of shmem
to see if data is available and act on that info.
Jul 2 '08 #5
Okay ... thx lot.

the tip "to specify the size of the largest image you expect" is great.
it works fine.
(but it could be faster when i know the correct size of the array)

if i use the event or windows messaging i donīt know yet.
greeting Martin
"Neo Morpheous" <bl*******@ursa-major.comschrieb im Newsbeitrag
news:BZ******************************@bt.com...
Martin Priebe wrote:
>okay ..

i use shared memory to transfer a bitmap from one process to the second
process.
it works.

but i have 2 problems.

first:
process one have to signalize "ready" - so process 2 can read out the
shared memory.

second:
i need to signalize "ready" + meta-data. (length of the byte-array)
when i use Win API CreateEvent and OpenEvent - it works.
But i canīt transfer any information with it.

greeting and thx
Martin

Sounds like you would have been better of using Windows messaging, since
that is more in line with the event-driven paradigm you appear to be
describing. For windows messaging, (assuming you had client/server and not
P2P model), you would create an invisble window in the client and you
simply send the data to the client from the publisher, when the data is
available. Small caveat, the size of the data payload is fixed (i.e.
cannot be changed), so your best bet would be to specify the size of the
largest image you expect to send, alternatively, you could incorporate
meta data in the payload, which allows you to split it into several
'packets' and then reassemble at the client side.

With shmem (shared memory), you need to set aside a portion of the memory
where your sender writes the status (ready, etc) as well as any metadata.
The client will have to continously poll this section of shmem to see if
data is available and act on that info.

Jul 2 '08 #6
okay ..
i send the size in the first 4 bytes.
so i read the 1st 4 bytes and then read out the rest with this length

thx
Martin

"Martin Priebe" <ma***********@hermos.comschrieb im Newsbeitrag
news:ey**************@TK2MSFTNGP05.phx.gbl...
Okay ... thx lot.

the tip "to specify the size of the largest image you expect" is great.
it works fine.
(but it could be faster when i know the correct size of the array)

if i use the event or windows messaging i donīt know yet.
greeting Martin
"Neo Morpheous" <bl*******@ursa-major.comschrieb im Newsbeitrag
news:BZ******************************@bt.com...
>Martin Priebe wrote:
>>okay ..

i use shared memory to transfer a bitmap from one process to the second
process.
it works.

but i have 2 problems.

first:
process one have to signalize "ready" - so process 2 can read out the
shared memory.

second:
i need to signalize "ready" + meta-data. (length of the byte-array)
when i use Win API CreateEvent and OpenEvent - it works.
But i canīt transfer any information with it.

greeting and thx
Martin

Sounds like you would have been better of using Windows messaging, since
that is more in line with the event-driven paradigm you appear to be
describing. For windows messaging, (assuming you had client/server and
not P2P model), you would create an invisble window in the client and you
simply send the data to the client from the publisher, when the data is
available. Small caveat, the size of the data payload is fixed (i.e.
cannot be changed), so your best bet would be to specify the size of the
largest image you expect to send, alternatively, you could incorporate
meta data in the payload, which allows you to split it into several
'packets' and then reassemble at the client side.

With shmem (shared memory), you need to set aside a portion of the memory
where your sender writes the status (ready, etc) as well as any metadata.
The client will have to continously poll this section of shmem to see if
data is available and act on that info.


Jul 2 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SLE | last post by:
Hi there, I am writing a service which monitors processes on the local machine. Currently I have implemented a System.Management.ManagementEventWatcher which raises events for processes being...
21
by: Alo Sarv | last post by:
Hi From what I have understood from various posts in this newsgroup, writing event loops pretty much comes down to this: while (true) { handleEvents(); sleep(1); // or _sleep() or...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
1
by: | last post by:
Does the page automatically reload when it processes en event or a method? When I click on a button and it processes the information, it loads everything into their respective textboxes but...
0
by: Ray G. | last post by:
I am converting some legacy code which will consist of 2 WinForm applications. In the legacy code Process A signaled Process B using a named event (e.g. each process attempts to Open the same...
5
by: Chris B | last post by:
I have the following situation: Process 1 creates Process 2 (using Process.Start(startInfo) Process 1 needs to wait until Process 2 is initialized before Process 1 can continue to execute Both...
6
by: AndrÃĐ | last post by:
Hi, I’m using win server 2003 and IIS 6.0, C# 1.1 When I check in my Event View under system, I see this Information Log: A worker process with process id of 'xxx' serving application pool...
35
by: Carl J. Van Arsdall | last post by:
Alright, based a on discussion on this mailing list, I've started to wonder, why use threads vs processes. So, If I have a system that has a large area of shared memory, which would be better? ...
3
by: =?Utf-8?B?THVib21pcg==?= | last post by:
C#, .NET 2.0 Hi, I have two processes and I need that one process will notify the other. I could use the EventWaitHandle object and create an (named) event, but this doesn't allow me to...
3
by: pbd22 | last post by:
Hi. I have a C# program that fires an external VB6 program which writes to a file and terminates. It is ugly, but this is how I have to do it. I cannot change this part of the program. The...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.