Is there any library to achieve data sending between ue program and non-ue program?

Currently I’m building a ue program to simulate a robot. I want to send image data from the UE5 program to another non-ue program, and send correponding command in the inverse way. I tried UnrealZeroMQ but got compile error (seems that version is not compatible). Can you recommend any easy-to-use library or just built-in plugins/api to achieve simple messaging?

Boost.Interprocess

We use protobuf messages over HTTP. The HTTP client is built in to unreal, and libprotobuf can be added (fairly easily) as a third-party library. Downside of HTTP is you have to poll to get messages from the non-ue program (which is running the server) to ue, but with NAT and firewalls this is an existing problem anyway.

How did you do this? I have tried something like that for so long and there is always something that doesn’t work.

Hey we are working on a similar thing and have tried to implement gRPC (protobuf), but without success. Is it possible for you to write a short guide? Also do you use windows or linux?

We target Windows and Linux currently (and Mac too at some point). Our libprotobuf port is in our Tasmania plugin, feel free to use it if you’re having trouble integrating protobuf:

We don’t use gRPC - just serialize the request and response to a HTTP POST request. We do actually use the protobuf service syntax in the .proto, but then generate an unreal C++ class from the reflection of the service definition with an in-house python script. But you shouldn’t need that unless you have a lot of different RPC messages, you can just write the code for each RPC manually to begin with.

To send a message you call:

  1. .SerializeToString on the protobuf request message.
  2. Then:
TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->SetVerb("POST");
HttpRequest->SetHeader("Content-Type", "application/protobuf");
HttpRequest->SetURL("http://yourservice.url/yourmethod");
HttpRequest->SetContent(TheSerializedProtobufString);

In the response handler you deserialize the response protobuf by calling GetContent on the FHttpRequestPtr to get the byte array, and then calling .ParseFromArray on the response protobuf message.

Let me know if you have any questions.

2 Likes

This Boost Plugin for UE should work (if this plugin includes Interprocess). I will try this one.