Search Unity

Viewing network bandwidth?

Discussion in 'Multiplayer' started by Evozer, Aug 27, 2015.

  1. Evozer

    Evozer

    Joined:
    Dec 28, 2013
    Posts:
    1
    I am currently running into the 4kbps limit and getting disconnected after a few minutes in my game. I'm trying to reduce bandwidth usage but I have not found a good way to display how many bytes I am sending/receiving. The stats functions on NetworkClient doesn't seem to work, same with NetworkServer functions, they all return 0. Anyone had any luck with viewing bandwidth usage?
     
  2. Firoball

    Firoball

    Joined:
    Aug 6, 2015
    Posts:
    62
    In short: Nope.

    I tried external analysis tools, but getting the byte/s sent around between Unity clients and server seemed to be a more complex task than I expected.

    I tried Microsoft Message Analyser, Wireshark and NetBalancer. I'll need to get back to those tools later, it was not "just three clicks and tada" as I hoped ;)
     
  3. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    651
    I am also having the same issues. I've used a stopwatch to time how long it takes to disconnect, then back calculated the bandwidth usage (ugh!).

    Some thing I've found that were chewing up bandwidth were setting SyncVar/SyncList to the same value repeatedly.
     
  4. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    The network panels of the profiler will tell you what operations you game is doing, but not the exact byte usage.
     
  5. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    651
    Ah thanks, that profiler is really helpful.
     
  6. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    Why still don't have a useful tool for tracking network traffic? it's very importance to implement and optimize
     
    Artaani and Deleted User like this.
  7. Deleted User

    Deleted User

    Guest

    bump
     
    Artaani likes this.
  8. UnityUser9860

    UnityUser9860

    Joined:
    Dec 8, 2015
    Posts:
    179
  9. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    80
  10. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    At least, NetworkTransport provides functions to retrieve byte counts. For example, you can use these to calculate something such as server outgoing KBytes per second.
     
  11. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    The solution is here, and here is an example of the loopback packets capturing.
     
    Jack-Mariani likes this.
  12. FakeByte

    FakeByte

    Joined:
    Dec 8, 2015
    Posts:
    147
    NetworkTransport.GetOutgoingFullBytesCount

    public static int GetOutgoingFullBytesCount();
    Returns
    int Total data (user payload, protocol specific data, ip and udp headers) (in bytes) sent from start for all hosts.

    Description
    Returns how much raw data (in bytes) have been sent from start for all hosts (from NetworkTransport.Init call).

    To determine the rate, sample this value periodically and divide the difference by the intervening time period.

    Source: https://docs.unity3d.com/ScriptReference/Networking.NetworkTransport.GetOutgoingFullBytesCount.html
     
    UnityUser9860 likes this.
  13. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Is there any method that still works? I would like to know how much data my app is pulling from the server over time as I try to improve efficiency.

    NetworkTransport.GetOutgoingFullBytesCount

    is now obsolete and doesn't work. Is there any other method that lets you know how much data your app is using up/down?
     
    sanchith_unity likes this.