Search Unity

"ChannelBuffer buffer limit of 16 packets reached."

Discussion in 'Multiplayer' started by PhoenixAdvanced, Jan 7, 2021.

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hi,

    I am making a game with simple multiplayer features, and when connecting more than one client I sometimes see the above error.

    I am guessing that this is due to sending data too quickly to the client (It occurs from within a loop), however, I have read that it is possible to increase this limit.

    How is this done?

    I am creating my server like this:

    NetworkServer.Listen(port);

    ChannelBuffer and Networkconnection seem to be "disposable", any changes I make there seem to be overwritten, and I can't seem to find any way to configure network options, unless I am completely missing something?

    I have tried changing the networkmanager gameobject to "64" under "max buffered packets" but it still shows as 16.

    Thanks!
     
  2. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    You cannot write to the property values of a NetworkConnection directly. What you can do is use the SetChannelOption function to change the maximum buffer size of a channel. For instance this increases the buffer size to 64 for the given connection on channel 0:
    Code (CSharp):
    1. networkConnection.SetChannelOption(0, ChannelOption.MaxPendingBuffers, 64);
     
  3. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Thank you, that seems to work!

    I am still gettting the error though, so I'm guessing the issue is with my core logic.