ayumax / ObjectDeliverer

ObjectDeliverer is a data transmission / reception library for Unreal Engine (C ++, Blueprint).
https://www.unrealengine.com/marketplace/ja/slug/objectdeliverer
MIT License
157 stars 36 forks source link

UDP Connection: No disconnect events #23

Closed Lildreas closed 5 years ago

Lildreas commented 5 years ago

Hello,

I'm using your plugin for UDP communication, I send MAVLink-protocol messages back and forth between two PCs. And it works beautifully.

But sometimes when I run the program in the UE Editor and then I stop the PIE (Play In Editor) the Editor halts, it doesn't crash but it just freezes.

I think that it might have to do with the UDP communication running in the GameInstance. So I tried to close everything (see image of the close function). And then I started wondering why I never get the "disconnected(receive)" message that is printed when "Disconnect_Event_0" is fired. The "Connected" events all fire and the "connected(receive)" string is written. For the SEND part the same things happen, no disconnected events are fired.

Do you have an idea why this might (or might not) happen?

Thanks & best Andreas

To close the connections I use the following function: CloseUDPConnection

This is how my RECEIVE stuff is set up (started from "Event Init" of the GameInstance): StartUDPConnection

ayumax commented 5 years ago

I'm sorry. I do not know the cause for the problem that "Editor" freezes now. "ObjectDelivererManager" automatically calls Close when it is destroyed. I feel like it's affecting it.

By design, ProtocolUdpSocketReceiver and ProtocolUdpSocketSender do not fire "disconnected" events. Also, the Tcp protocol normally fires the "disconnected" event, but the "disconnected" event does not fire when the Close method is called.

Lildreas commented 5 years ago

Hello, thank you for looking into it and your detailed answer.

A suggestion: Maybe you could create a public "Destroy" method for the ObjectDelivererManager, and Destroy would unbind everything, close the connection and then destroy the ObjectDelivererManager?

If you do this then I can e.g. implement a [DISCONNECT] button in the simulation that disconnects everything, and only afterwards I stop the simulation in Unreal. This way hopefully no freeze would happen.

Best Andreas

Lildreas commented 5 years ago

Hello,

one more detail: I now implemented a DISCONNECT button that when pressed calls the "CloseConnectionUDP" function shown in the screenshot above.

I hoped that UE will not freeze when I hit DISCONNECT and afterwards stop Play In Editor.

But the problem persists, sometimes when I hit DISCONNECT UE freezes.

Best Andreas

ayumax commented 5 years ago

I fixed it because the cause of this problem was found With this fix in place, there is no need to call "Close" when leaving the Editor. It should be reflected in "UE4 Marketplace" within a few days. Please wait.

Lildreas commented 5 years ago

Thank you again for your fast support! I really like ObjectDeliverer, it helps a lot!

Lildreas commented 5 years ago

Hi,

just as a feedback - there are no Editor freezes anymore, your fix works perfectly.

Thanks & best Andreas

ayumax commented 5 years ago

It was good to fix it. Thank you for your report.