What options do we have for interprocess communication ?


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.

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.

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.


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.