You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@blackclavus I haven't run your sample yet to investigate the issue, but are you sure, that this problem is not related to fact that UDP doesn't guarantee ordered delivery of datagrams? (in UDP receiver may get packets in different order than the one, in which sender has send them)
I'm aware that UDP doesn't guarantee ordered delivery of datagrams, but I'm afraid that is not the case. The problem is: the content of ByteString seems to be replaced by newer data, but the length is still maintained. I also tested with another code with simple UDP Listener (without using Akka.IO.Udp) and it give correct ByteString.
Here is the code:
publicclassUdpListenerActor:ActorBase{privatereadonlyUdpClient_udp;publicUdpListenerActor(IPEndPointserverAddr){_udp=new UdpClient(serverAddr);}protectedoverridevoidPreStart(){
Self.Tell(Listen.Instance);}protectedoverrideboolReceive(objectmessage){if(message is Listen){
_udp.ReceiveAsync().PipeTo(Self, Self);returntrue;}if(message is Udp.Send send){vardatagram= send.Payload.ToArray();
_udp.Send(datagram, datagram.Length,(IPEndPoint)send.Target);returntrue;}if(message is UdpReceiveResult result){varreceive=new UdpReceived(ByteString.FromBytes(result.Buffer),
result.RemoteEndPoint);
Context.System.EventStream.Publish(receive);
Self.Tell(Listen.Instance);returntrue;}returnfalse;}privateclassListen{privateListen(){}publicstaticreadonlyListenInstance=new Listen();}}
Akka version: 1.3.2
Platform: .net core 2.0
When client sending several packets at once (within a loop) like this:
Server will receive incorrect bytes like this:
The length of the bytes remain correct but the content is replaced by other bytes.
Here code sample to reproduce result above:
Server:
Client:
The text was updated successfully, but these errors were encountered: