Click here to Skip to main content
Email Password   helpLost your password?

Introduction

.NET inter-process mechanisms are very slow. With some system calls, it becomes easy to use file mapping and that's the faster mechanism for IPC.

Classes

EXEs

Points of interest

The sample programs included here runs at 250.000 msgs per second on a PIV 3 GHz. But they block each other while accessing the channel and the CPU is not 100% busy.

With MemMap class support, it becomes easy to implement other IPC mechanisms as shared Dictionaries.

History

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
Generalwith read from C++ program
ftaka
22:06 29 Apr '08  
Is there a way to read from a C++ program using this? I want to get a string from a program which has written to the memory using copymemory.
I've tried using this library but returns the error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." in VB.net

Help please.
GeneralCode corrected and revised
aalday
21:18 21 Jan '07  
The crash reported has ben fixed.

The locking mechanism has been replaced and performance boosts to 250.000 msg/s.




GeneralSomething wrong
Alexey_i
2:33 21 Oct '06  
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OutOfMemoryException: Channel:MSERVER Buffer Full
at MClient.MemChannel.putmsgwait(String msg, Int32 timeout)
at MClient.MClient.btnSendN_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///d:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
MClient
Assembly Version: 1.0.2002.24080
Win32 Version: 1.0.2002.24080
CodeBase: file:///D:/Documents%20and%20Settings/Alex/Desktop/IPC/memmap/MemMap22/MemMap/MClient/bin/MClient.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///d:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///d:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///d:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase: file:///d:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.


GeneralRe: Something wrong
aalday
21:16 21 Jan '07  
The code is now corrected.

The locking mechanism has been replaced and performance boosts to 250.000 msg/s.

Please try again



GeneralFaster implementation
studio_ukc
9:18 28 Sep '06  
Maybe my article can help you make your code run a little faster.

http://www.codeproject.com/useritems/fast_ipc.asp[^]

This c++ IPC implementation does over 2,000,000 msg's per second.

I was thinking about writting my own C# implementation of the IPC method I presented but time was not on my side so I never did. Any how this should give you some ideas to accelerate yours.


John
GeneralCopyright/Usage?
brian_birtle
7:25 6 Nov '05  
Thanks for posting such a useful module. Is it OK if I use it in my commercial application? We'll make sure your name and a link to this website is clearly listed in the code so all our developers know what a help you've been.

Big Grin

- Brian
GeneralRe: Copyright/Usage?
aalday
10:29 6 Nov '05  
Sure, no problem
GeneralNext time post in proper category
fwsouthern
20:51 25 Jun '05  
Post in VB.NET, not C#
GeneralRe: Next time post in proper category
aalday
22:28 25 Jun '05  
OK. Changed
GeneralFORTRAN
Anonymous
14:23 25 Jun '05  
Any ideas of how this might work to do IPC with FORTRAN?
GeneralSeems great
Daniel Turini
13:26 25 Jun '05  
I didn't test it yet, but seems nice.
It'd be interesting trying to write a Remoting channel over it (you just need to implement IChannel, IChannelSender and IChannelReceiver) to see if it can beat the TcpChannel.

I see dead pixels Yes, even I am blogging now!
GeneralRe: Seems great
aalday
22:40 25 Jun '05  
Look for IpcChannels on .net 2.0.

http://msdn2.microsoft.com/library/h9ew6576(en-us,vs.80).aspx


Last Updated 22 Jan 2007 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010