When sending messages with NetworkServer.SendByChannelToAll() at 60Hz from server to client, I can see up to 7 of these packets arrive at the same time on the client, which seems unusual given: * This is on a LAN (all machines wired -- ping as returned by GetCurrentRTT is low single digits) * Connection SendDelay is set to 1ms (other connection settings are default) * Sent on channel with QoS UnreliableSequenced * The data isn't overly large (payload is about 48 bytes + packet overhead) Interestingly the Client sends to the Server at 60Hz with same payload, any I've only seen up to 3 packets arrive at once. It's important for us to get these messages transmitted with minimal delay and hopefully keep the jitter to 3 packets at once or less (I know it's unrealistic to expect them to arrive evenly at the same 60Hz frequency they were sent). This is with 2017.1.p2 Before I take the time to replicate in a smaller test project, I was hoping someone would say "Oh, you have to change XXX to YYY in the Connection Config to make sure there is no delay on either end".
I tried setting SendDelay to 0, and got the same results. Doing a bit of research in the forums, I see there is another parameter that affects send latency: GlobalConfig.ThreadAwakeTimeout The docs don't say what the default value is, and it's a bit unclear to me how this gets used if you are using the HLAPI. Specifically we use NetworkServer + NetworkClient.
Furthermore, it appears the delay could also be caused by bandwidth throttling. Details: https://docs.unity3d.com/ScriptReference/Networking.ConnectionConfig.InitialBandwidth.html I'll come back with more info after I experiment with the Bandwidth stuff -- that sounds like the most likely explanation.
It's a common problem not only because of UNet but also because the networks, software, and hardware are not perfect. You are trying to find a source of the problem this is what comes to mind intuitively. But such things should be resolved with the well-known, wise, and practical solutions. That's why a de-jitter buffer exists.
Cranking the bandwidth super high didn't have any impact, still seeing up to 8 packets arrive simultaneously on the client when they were sent at a 60Hz send rate from server.
And it will happen all the time at this frequency and rarely at lower. A low-level transport is smart, and it will try to merge packets into one due to different conditions to avoid issues with throughput, performance, latency and other stuff. You are trying to solve the problem in wrong way. Here's another low-level transport where I send sequenced reliable and unreliable packets at the same frequency: And it's not even a network but my local machine.
For my particular use case, I need to minimize the latency between the packet being sent and the packet being processed on the other side. It's simple to buffer on the receiving end to ensure that they "play back" at 60 Hz, but I'm looking to minimize how much I buffer. I'll try out a lower frequency to see how that impacts things... one of the reasons I'm using 60Hz is to minimize latency, but that is counter productive if I end up receiving packets in batches of 5 - 8. Like I mentioned above though, the problem is less severe going from client to server (worst case I've seen is a clumping of 3 packets)... which I can't explain.
Well, turns out it was this: https://docs.unity3d.com/ScriptReference/Networking.NetworkServer-maxDelay.html The default in the docs say 10ms, but it's actually 100ms.
Hi @alan-lawrance, I just came across this post and I am having a similar issue, but my burst is of a single message and not 7 or 8 as you reported. This happens to around 40% to 50% of all the packets transmitted at 60 Hz, and it doesnt happen if I lower the rate. Did you ever solve your problem? I tried setting the networkserver.maxdelay (0.01 and lower) but got no improvement, but maybe I am not calling it correctly? I just added this to my server script, after setting it up. I also got the recommendation to configure the threadawaketimeout and the senddelay, but it didnt have any impact, but I was told I am probably not calling this correctly either but havent figured out how to call it correctly. Code (CSharp): GlobalConfig globalConfig = new GlobalConfig(); globalConfig.ThreadAwakeTimeout = 1; ConnectionConfig config = new ConnectionConfig(); config.SendDelay = 0; Here is my post about my issue and the very simple scripts to reproduce the https://forum.unity.com/threads/une...rval-not-consistent-and-burst-arrival.586468/ Thanks a lot for the help!