My current project involves building a high speed framework for communications across different OSs and remote systems for computer vision applications where the various components communicate using ZeroMQ sockets. This works fine in Standard C++ (Non-Cli).
I have recently found a use-case where I need to interface with an application coded in C#. Having compiled and run the "Hello World" example from the guide (On localhost) with clrzmq 2.2.2. I cannot get the two programs to communicate (One in C++ one in C#).
The C# server receives a request from the C++ client but nothing happens after that, it just seems to hang, which would indicate a problem with the C# response. Replacing the C# server with a C++ one compiled from the guide works fine.
Does anybody have any experience of getting C++ apps to talk to .NET using ZMQ? I would be grateful for any help, as this is not covered in any documentation I have been able to locate.
That is likely to be an application bug. We have a program like that running without issues. C# to c++.
Related
I have just start learning about WCF that can help me for the communication between two different platform application. I have also created one simple application for the communication but both client and service are written in C#. I want to know how I can establish a C++ and C# application so that they communicate to each other. Thanks in advance
this question seems very wide to me, the thing is since you are in windows, and the C# and C++ applicattions will be running simultaneously, you have to thing in the specific requeriments of you appliccation.
For example, I had a Server in C# wich recived some data, that had to be processed in C++ and then returned to the sender, so, since the C# and C++ process were in the same computer I used a File Mapping method, for example.
Indepently of the language, what you have to make sure, is that the data you send, wen you recive it in the other process, that should be able to be understood.
Here is a link for more info in wnidows
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx
I am trying an application to write an application on which I have used a client/server architecture. The client side is developed using .NET\C# and the server side is developed on python. To communicate the both sides, I used first tcp/ip socket; so i put my python's methods on a loop then I ask each time from my c# application to run an method. This idea is very bad as it require to cover all use cases that can be happening on network or something like that. After a work of search, I have found three technologies that can answer a client/server architecture which are RPC, RMI and WCF. RMI a java oriented solution so it is rejected. So, my question here is: does RPC and WCF support multi programming languages (interoperability) especially betwenn C# and python?
I'm not sure I completely understand your use case, but I would suggest having a look at a REST API approach if you need to have .Net talk to Python, or vice versa.
An alternative is using Pyro4 to expose Python objects on your Python server side and talking to them via the C# client library provided by Pyrolite. This mostly hides any networking specific programming details.
We're working on a project that requires us to interface with a specific set of hardware; one set can be controlled very easily using C#, the other of which is natively programmed using Python. Part of the project involves getting the hardware running on Python to communicate with the hardware running through C#, and unfortunately, due to time constraints, we aren't able to create a set of C# or Python software to control the other set of hardware.
The set of hardware running on Python is completely event based, in that we can program functions that are called when certain conditions are met by the hardware. Our thought was to modify the C# application controlling the other set of hardware to host the Python application (using something like Application.Run()), then program the Python functions to propagate relevant data to the C# application as the events come in from the hardware.
We're considering using a socket connection to handle communication between the two, as both C# and Python are fairly simple to get working that way (or so our Python guy claims). The biggest concern with this that we have is if there will be any issues with the fact that both programs will be hosted on the same machine. If this won't be an issue, we would probably end up using a shared library such as 0MQ
We've also done some research into the following areas:
Pipes / Named Pipes
Message Queues
Shared Memory
Basically we want to know which method of these (or any others) will be the easiest to implement with these languages, and which will give us the best performance. We are concerned only with speed and accuracy of the data (ie, if using network packets, one that will drop the least). Security is not a concern.
Ideally, there should be one data stream going from the Python application to the C# application, and two data streams going from the the C# application to the Python application. The host machine will be running Windows 7. I can give additional information as needed.
One option is to try IronPython. Since IronPython is a .NET language, communicating with C# code should be easy.
It seems worth looking into how hard it would be to get your existing Python code running on IronPython.
I have a game server which is made in Java. I want to make a plugin system that loads a .NET DLL and calls events / functions inside that DLL, then inside those I'll have to call functions in the game server (Java). The only part that is giving me trouble at the moment is how to interface java and a .NET dll.
I've been searching and found some things but they were all based on products and I want to make my own interface for that. Ah, not to mention it needs to have high performance, the code will be called a lot of times in a second if it has to. Could someone point or give-me ideas how could I work this out?
EDIT:
To make it more explicit:
Game Server (Java application) calls a function in .NET dll
The .NET function just called by java, calls multiple functions from Game Server (Java Application).
Take a look at jni4net if you're targeting Windows. It's an alpha quality release, but Robocode already uses it to run .NET robots inside the Java runtime.
Another option is to use a high-performance messaging approach. You'll need a second process - likely a .NET plug-in host. That process then exchanges messages with the main Java game process. Messaging libraries like 0MQ are pretty darn fast but may not be fast enough for what you have in mind. In addition, you'll have to create a lot of message plumbing which may be cost/time prohibitive.
Try using iKVM:
IKVM.NET is an implementation of Java for Mono and the Microsoft .NET
Framework. It includes the following components:
A Java Virtual Machine implemented in .NET
A .NET implementation of the Java class libraries Tools that enable Java and .NET
interoperability
http://www.ikvm.net/
If you only have a few methods you are calling you might just use JNI and do it yourself instead of a 3rd Party tool (though I admit I don't know the details of jni4net). Just a word of caution, the project I'm on had to do a similar thing (C# -> C/C++ -> Java via JNI) and we had nothing but problems with it. Problems mainly because the java api didn't have any good documentation so that might have been part of it. If at all possible try to keep it to one language but if that is not possible, make sure you do lots of error checking. When the app crashes, it is very hard to find the problem (unless you own both the java and C# sutff). Just my $0.02...
I have C++ application which has UI developed using MFC, does some networking using sockets (using boost libraries) and some image processing. I want to move this application into Silvelight framework (I can use 4.0 if required) so that it can be used over the internet easily. Here I want to move all parts (UI + networking etc) in to C# but keep the image processing code in unmanaged C++ only. I don't know .NET framework yet, but whatever I have read so far suggests that it is not possible to call the unmanaged code from a silvelight web application. Is my understanding correct? Can something be done to achieve what I am trying to do? Also, if somebody has some suggestions on how to go about porting the code?
Silverlight 4 supports COM when running in trusted mode.
So, tecnically you could have Silverlight call your c++ library using COM.
The main problem I see is on deployment and I don't think it's a good idea.
Also, remember that Silverlight can run on Macs but COM is Windows only.
What you could do is to have the image processing happening on the server, but then you
can run into scalability issues.
Transfering large amounts of data between client and server can become an issue.
UI response should probably be closely evaluated too.
Regarding porting the code, well, you are most certain looking at a complete rewrite.
I'd suggest using WPF instead of Silverlight if possible. With WPF you'd be able to reuse your C++ as is because desktop .NET / unmanaged interop is very good (P/Invoke or CLI/C++).
Otherwise you are stuck porting your C++ to managed code, which could prove to be laborious and the resulting code inefficient.