I'm following this article to do the remoting
http://www.codeguru.com/csharp/cshar...cle.php/c9251/
But the problem is that the server and the client are not really sharing the object (two copies are generated).
I'm using singleton mode.
Code:IpcChannel channel = new IpcChannel("EDMChannel"); ChannelServices.RegisterChannel(channel); RemotingConfiguration.RegisterWellKnownServiceType (typeof(Pipe), "Pipeline", WellKnownObjectMode.Singleton);
The following is my remote-able class
I want to share "Pipe" object across the server and the client with all the data intact. When one side updates the object, it must be visible on the other side.Code:namespace Remoting { public class Pipe : MarshalByRefObject { private static Record[] records = new Record[300]; private static int current_pointer; private static int window_size=300; public static void Push(string message) { records[current_pointer] = new Record(DateTime.Now, message); current_pointer++; if (current_pointer >= window_size) { current_pointer = 0; } } public static List<Record> Pop(int ask) { List<Record> result = new List<Record>(); if (ask < 0 || ask > window_size) { return null; } if (ask < current_pointer) { for (int i=ask; i<current_pointer; i++) { result.Add(records[i]); } } else { for (int i = ask; i < window_size; i++) { result.Add(records[i]); } for (int i = 0; i < current_pointer; i++) { result.Add(records[i]); } } return result; } } }
How do I go about that?
Ps: I've tried making the class nonstatic and singleton but to no avail




Reply With Quote