- Home /
What options do we have for interprocess communication ?
Hello,
I would like my unity standalone application to receive large buffers of data from another C# application running on the same PC computer.
What options do we have available through Mono (without using plugins or .net remoting) ?
Interprocess TCP communication seems the obvious choice but isn't there anything faster/simpler ?
Named pipes being a .net 3.5 feature, no chance.
Any idea or advice would be most welcome.
Answer by AngryAnt · Mar 31, 2010 at 09:17 AM
If you do not require the other process to be running before the Unity one, you could have your Unity project launch that via Process and then redirect stdin/out to streams and communicate through these.
Example:
Process otherProcess = new Process (); otherProcess.StartInfo.FileName = path; otherProcess.StartInfo.CreateNoWindow = true; otherProcess.StartInfo.UseShellExecute = false; otherProcess.StartInfo.RedirectStandardInput = true; otherProcess.StartInfo.RedirectStandardOutput = true;
// Now communicate via streams // otherProcess.StandardOutput // and // otherProcess.StandardInput
It is also possible that grabbing a running process by name or pid and then setting the forwarding would work, but I've not tested this and it does seem rather doubtful.
This looks like a nice trick. Do you think it would be faster or slower than TCP communication ?
Answer by qJake · Mar 31, 2010 at 08:31 AM
You could use a TCP process, and that's likely your best bet. The loopback interface on most computers is fast enough to handle large amounts of data.
For generalized interprocess communication information, refer to this handy MSDN reference page. Some examples (like named pipes, as you mentioned) will be in newer .NET versions, but I'm sure there's something there that you could use.
Your answer
Follow this Question
Related Questions
Possible to communicate from HTML to unity standalone app? 3 Answers
Problem web service / standalone 1 Answer
OSX Build cannot go fullscreen? 0 Answers
Shader EnableKeyword Standalone version 0 Answers
Game crash on Ubuntu 2 Answers