ObjectDeliverer icon indicating copy to clipboard operation
ObjectDeliverer copied to clipboard

When receiving big messages (> 7000 bytes) it seems that the receive event returns a partial buffer first

Open brunoleos opened this issue 5 years ago • 3 comments

I think this is a bug, or maybe I'm misusing it.

I'm trying to receive big messages (>300kb) with a TCP server in Blueprint. I normally can receive small messages by inspecting the TArray returned by the ReceiveObject blueprint event.

But when the received message is big, the TArray is returned with less bytes than the message sent to the server, and after a first return, another event is triggered, which yield the remaining bytes in the TArray. But my application needs the full message in the buffer (or if this behaviour is intended, I should have any means to know that the message is split, and that I must wait the remaining bytes).

My server is configured with PacketRuleNodivision, and default options.

brunoleos avatar Mar 13 '21 03:03 brunoleos

I've tried to fix my problem using PacketRuleSizeBody. I've specified a size header of 4 bytes. I can send small messages sending the size first and then the body with corresponding bytes in length.

But when it comes to bigger bodies, the problem happens again, two chunks are received, in two distinct receive events: the first chunk received has a random amount of bytes (between 6kb and 12kb), and the second chunk has the remaining bytes of the original message.

If the chunks where appended, it would work... But the message is only accepted in this PacketRule if it has exactly the specified size, so I couldn't solve my problem yet.

brunoleos avatar Mar 13 '21 06:03 brunoleos

@brunoleos did you find a solution ? My client doesnt disconnect, it simply stops receiving messages

azukaar avatar Mar 24 '21 19:03 azukaar

@azukaar I haven't found a solution, but I think the problem is with the concept of TCP. The definition of my message boundaries is in layers above TCP. TCP splits my message in small packets. I thought that the TCP API provided by this plugin and other TCP libraries would pack all the data and return the big buffer when a Receive() call returns. But that seems not to be the case.

The solution I imagine is to reserve some bytes in the begining of the message to tell the application how many bytes should it receive from TCP to build the complete incoming message.

brunoleos avatar Mar 29 '21 19:03 brunoleos