InProc/OutProce memory sharing

  • Thread starter Thread starter source
  • Start date Start date
S

source

I have two exes and would like to share a simple boolean variable among two
exes. The client will setup the value for hte boolean while the server will
read
it.How do I do that?
I have a Server.exe and I have a client.exe

Client.exe setups the value and I want my server.exe to read it.
I do not want to save to a file/db, I want to do it on the memory level.

Any pointers will be helpful
source
 
John,
Could you be little more specific.
I have tried using remoting and all that I could think of.
My problem is, I have a static structure which I try to access from my
client.
Now I am able to access the static properties exposed by my static structure
(class/structure) but when I am back on server the properties that were
initialized by client do not retain those values and when the server tries
to access those properties I do not get those values that were set by the
client.
So essentially the static properties do not retain the values when the
server tries to access them.

source
 
Have you looked at all the Remoting examples for setting up a chat server?

Specifically, look at how it registers the list of names of people who
connect to the server.

As each client connects, it can read the list of available people. And
as that list changes, you can have a remoted event that updates the client.

You don't need to "poll" the server -- that's the beauty of remoting --
you can remote methods so that clients are automatically updated as
values on the server change.
 
Hello, source!

If the only thing you want do is reading bool flag then you can use named mutex object for this. If mutex is occupied that flag equals to true, otherwise - false. Or even better - you can check if mutex with special name exists then flag is true, otherwise - false.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
you could use remoting.

Set up a the server.exe to accept client connections, and then have it
poll the server.exe for the value of the shared variable.
 
Hello John,
I understand what you are trying to say that server does not need to poll
anything because it exposes the api for the client to do housekeeping.
I am refering to the chat application you mentioned.

But in my case, once the client connects, my client is going to initialize a
boolean, which my server has to READ it.
So I want a mechanism where if client initializes a variable, I wante the
server to read it.

In most of the chat applications I saw over the internet all the server does
is creates a channel and waits on
COnsole.Readline()
there is not interaction of the server with any of the datastructure that is
being used by the client.

So this brings me to wonder if in remoting can you get hold of an existing
instance of the server rather than creating a new instance of the server?
which will enable to share variables

source
 
Back
Top