Yes..It is derived from MarshalByRefObject ( I just followed the
example in MSDN)
It is like following:
public class SharedObj : MarshalByRefObject
{
public void LoadFileToMemory(string filename)
{
}
public void GetFileFromMemory(string filename, ref MemoryStream
ms)
{
}
}
Client A calls LoadFileToMemory, and Client B calls GetFileFromMemory,
so the content of file (store in a MemoryStream) is passed from
Process Client A to Process Client B.
I test the time to read the file from the disk and the time to pass
the memorystream from A to B, it is roughly the same speed.. How can
IO compete CPU in speed?
On Aug 8, 12:21 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Does the SharedCache type derive from MarshalByRefObject? If so, every
call you make will be marshaled back across the app domain boundary, and
this could definitely add some overhead.
Also, how are you transporting the file?
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"tony" <fanglu...@gmail.comwrote in message
news:11*********************@j4g2000prf.googlegrou ps.com...
I use Ipcserverchannel class and Ipcclientchannel to do IPC. I try to
read a file to memory using process A and then use IPC to transport it
to process B. However, IPC use nearly as much time as from a from
disk, which is very surprising ( I expect it to be much much faster).
What could possibly be the problem?
Part of my code:
Server:
IpcServerChannel serverChannel = new
IpcServerChannel("remote");
ChannelServices.RegisterChannel(serverChannel);
// Expose an object
RemotingConfiguration.RegisterWellKnownServiceType (typeof(SharedCache),
"myObj", WellKnownObjectMode.Singleton);
Client:
clientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(clientChannel);
RemotingConfiguration.RegisterWellKnownClientType( typeof(SharedObj),
"ipc://remote/myObj");
ShareObj is the shared remoting object which can reading the file from
the disk and transport the file to the client process.- Hide quoted text -
- Show quoted text -