Reputation: 25397
I'm a little stuck here. I have a Server B that is written in C# .NET and communicates with a device I want to work with (e.g. debug it). Then there is Server A (written in C) which communicates with my Eclipse. These two things are no problem at all.
The Problem begins at the point where I need to communicate from Server A to Server B. I can not use the DLLs from B in A since they are written under .NET Framework 2.0 and using those inside C code seems to be rather complicated.
My question is: What are my options here?
There is not a lot of complex data that would have to be transmitted. All of it could easily be transmitted bytewise since the data will be either a string, a number or binary data (executable).
I was thinking about creating a simple protocol which sends byte commands from Server to Server over TCP but I am not sure if this is a good solution.
This is a fundamental design decision since both projects are quite large. I have to decide with care. Any suggestions?
Thanks! (Feel free to edit the tags of this question if you have better ones for me)
Upvotes: 0
Views: 222
Reputation: 4094
Looking at your comments and seeing how both servers are going to be hosted on the same machine, you could consider using a basic memory mapped file to communicate between the two:
Memory mapped files in C# / Named Shared Memory in C
However, if you want to make this platform independent you could look into using Protobuf which is available for C# and C, amongst others. This would take your idea of creating a TCP protocol, but you use a well documented and industry wide protocol which will make the application easier to support going forward.
Upvotes: 1
Reputation: 9639
One option would be to use DCOM; here are a couple of articles to get you started: How to write a DCOM server in C#, Calling Managed .NET C# COM Objects from Unmanaged C++ Code. If both the C# and C processes are on the same host, then COM would be sufficient and the code is a bit simpler.
Upvotes: 1