473,775 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2076
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 "InterProce ss 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*******@ur sa-major.comschrie b 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.comschri eb im Newsbeitrag
news:ey******** ******@TK2MSFTN GP05.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*******@ur sa-major.comschrie b 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
1005
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 launched: New WqlEventQuery("SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process'") So far so good but I need additional information (e.g. window title)
21
18757
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 nanosleep(), depending on platform }
13
7498
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 it, a frontend and a backend. Case 1: If vba code on the frontend updates many rows (360,000) on the backend, a form's timer event (from the frontend) will stop firing until the user gives the form focus. (Note that the update itself always...
1
8264
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 immediately then does a refresh. Unfortunately, on my page load event, I tell it to clear everything (then the user doesn't see the result). Is it possible to tell the web app NOT to refresh unless the user hits the Refresh button in the Explorer?...
0
1283
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 named event, the first to fail will do a Create on the named event from that point on Process B will signal Process A by setting the named event and Process B has a thread blocked on waiting for the event which when fired will be immediately reset as...
5
2071
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 processes are non-GUI processes. The problem that I am running into is that the Process.Start(startInfo) returns immediately to Process 1. Therefore, process 1 does not wait on its own for Process 2 to initialize. Process 2 can take a few...
6
5734
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 ‘xxx’ has requested a recycle because the worker process reached its allowed processing time limit. Source: W3SVC Event: 1074
35
4043
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? I've been leaning towards threads, I'm going to say why. Processes seem fairly expensive from my research so far. Each fork copies the entire contents of memory into the new process. There's also a more expensive context switch between...
3
7473
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 pass any parameters.
3
2222
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 problem I am encountering is that the former process created by this EXE is not complete (it runs for a few seconds) when the next one wants to start. A
0
10270
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10051
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2853
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.