473,388 Members | 1,234 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,388 software developers and data experts.

Why is IPC communication so slow?

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.

Aug 8 '07 #1
2 2785
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]
- mv*@spam.guard.caspershouse.com

"tony" <fa*******@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.
Aug 8 '07 #2
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 -

Aug 8 '07 #3

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

Similar topics

9
by: Harald Massa | last post by:
Hello, I have a group of Python programms which I want to teach to "talk to each other". All run on Windows, on the same computer or in the same intranet. Security of communication is not an...
9
by: Emmanuel Charruau | last post by:
Hi, I am looking for a class or any information which would allow me to make communicate mini-module in c++. I have been looking on the net for some examples of such implementation, but I did...
4
by: Frank Meng | last post by:
Hi. I am trying a csharp sample from http://www.codeproject.com/csharp/socketsincs.asp . (Sorry I didn't post all the source codes here, please get the codes from above link if you want to try)....
2
by: Leonardo D'Ippolito | last post by:
Hi! I have two .NET win apps that need to communicate on a TCP/IP network. 'App A' must ask 'app B' if it's allowed to do some task, and 'app B' must authorize or prohibit it. How can I do...
1
by: paul.drummond | last post by:
Hi all, I am new to whole idea of "web services" and architectures such as .NET and J2EE so please bare with me. I am trying to research as much as possible before asking silly questions but...
4
by: Lonifasiko | last post by:
Hi, I've been able to communicate using HyperTerminal with my device via serial port COM1. I just send a command and device switches on. I just need that to start playing with it. This way, I...
4
by: =?Utf-8?B?RG91ZyBE?= | last post by:
Hey all- I am pretty new to serial communication, but from what I am experiencing it is a little slow in VB.net (2.0). Using other tools I can communicate with my hardware extreamly fast without...
4
by: =?Utf-8?B?YWx2YXI=?= | last post by:
Hi, I am to write a C# game serrver, which would communicate with a C++ client. It should be used just for the administration communication (not during the game itself, just administrating...
4
by: nmsreddi | last post by:
Hi friends , after a long busy work happy to back to forums, i have developed a windows application(C#2,0) for serial communication. the aim of my application is to connect to external...
5
by: AeonOfTime | last post by:
Let's assume a web application (in this case a browser-based game) with a custom HTTP server built on PHP, and a client also built on PHP. The client uses the server to access and change data. Even...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.