[Closed] C# Memory pipe between Max and apps possible?
Hi guys!
I just want to know if it’s possible to communicate between maxscript and a C# application with a memory pipe? And any chance to have a example!??? Or maybe easier with a socket connection? DenisT ???
Thanks
Ozray
unfortunately i couldn’t complete my research of this matter, and didn’t get any success. it seems like to share the same memory with max and another c# application would be a problem. also i couldn’t find easy way to communicate with other c# application using a common object.
so the only way that i see, and would look at is a socket connection… as soon as i have time i will make a new try.
please let us know when you make any progress.
Yep we have something working!!! Yeaaaa!!!
When it will be clean and commented I will post all the information!
I have Maxscript talking in near realtime (depend on timer interval) to
our inhouse tools in a memory pipe!
Regards,
Ozray
Ok… First I’m not a C# programmer so I will give you hint on what our C# expert here have told me.
What he use is:
CreateFileMapping
OpenFileMapping
MapViewOfFile
Win32 API (Kernel32.DLL)
Is C# class that I import in 3DSMAX look like this:
http://pinvoke.net/default.aspx/kernel32/CreateFileMapping.html
So in our inhouse tool he created a MemoryPipe file then with a little protocole
between maxscript and the inhouse tool we can exchange strings to drive actions
on both way. I can control in Max our inhouse tools!
That’s the informations I know for now
Regards,
Ozray
the file mapping approach sounds very interesting. unfortunately i’m very busy now to dig it. hopefully someone will post the complete solution.
Is there some specific reason you need to use a memory pipe? Here are work we use both WCF and the ManagedServices.dll that ships with Max to communicate between Max and our tools.
In fact after benchmarking memory mapping is faster. We are communicating directly in realtime, and we need it for the kind of project. And the protocol we have designed is based on string sent and receive so it’s very short and no need to encapsulate. But maybe there is some other advantages in using WCF.
Regards,
Ozray
Could we expect something of this being published as open source or is it closed source only ?
Would be great if this could kick off some initiative to form kind of a standard for such interapp-communications. I’ m currently investigating the same thing ( but on the C++ side of things), but i think i will use named pipes, which has the advantage to work over the network. That’s not the case with memory mapped files…
For example the command line rendering tool shipping with Max ( 3dsmaxcmd.exe + cmdlineLibrary.dll) is communicating to 3ds Max via named pipes ( called MaxToServer and ServerToMax)