Download

UE4.27 Remote API Plugin timeouts requests from C# HttpClient on LAN

Hello.

I’m using self-written C# WPF application to control UE level in PIE-mode (in new window).
One of the app features - controlling UE level that is started on other PC available on LAN.

PUT requests are sending by C# System.Net.Http.HttpClient that is configured next way:

HttpClient = new HttpClient(); HttpClient.Timeout = TimeSpan.FromSeconds(5); HttpClient.BaseAddress = new Uri(BaseUri + _Endpoints[“ObjectFunction”]); HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(“application/json”));

BaseUri consists of “http://MACHINE_IP:30010” where MACHINE_IP is localhost or IP of second machine in LAN.
_Endpoints[“ObjectFunction”] is “/remote/object/call”

When I’m controlling UE level in PIE on localhost (i.e. my controller app and Unreal are started on same machine) - it works perfect.
When I’m controlling UE level on other machine in LAN - it catches few requests (i.e. they are accepted and needed changes appears in level) and then I start catching timeouts on all further requests.

Timeouts continues until I restart my controller app or “reset” HttpClient by same method as I mentioned above:

HttpClient = new HttpClient(); HttpClient.Timeout = TimeSpan.FromSeconds(5); HttpClient.BaseAddress = new Uri(BaseUri + _Endpoints[“ObjectFunction”]); HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(“application/json”));

“Reset” happens via special button in my app so it can be performed “on runtime”. After such reset, UE catches few requests and starts timeouting again.

Interesting moment is that I tried to make few calls from Postman on first LAN PC to UE on second LAN PC and it works great - timeout never occured.

My “config”:

  1. Two PC’s in one LAN network, both with turned off firewall. No additional network filtration soft/hardware.
  2. UE 4.27 on both.
  3. Add following to Engine/Config/BaseEngine.ini:
    [HTTPServer.Listeners] DefaultBindAddress=0.0.0.0
  4. Start PIE of needed level in new window on one PC
  5. Send few (2-10) requests from application (own-writed, but it can be simplest console solution)

Has anyone encountered this or something similar? Hoping for guesses about the direction of the search for a solution?
Can it be a problem from UE side? Maybe listener is recognizing HttpClient instance by some signature as untrusted after few requests or smth like that? Or should I take a look at HttpClient configuring?

Thanks.