Search Unity

Viewing network bandwidth?

Discussion in 'Connected Games' 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:
    60
    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:
    615
    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:
    615
    Ah thanks, that profiler is really helpful.
     
  6. Rachan

    Rachan

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

    wobes

    Joined:
    Mar 9, 2013
    Posts:
    669
    bump
     
    Artaani likes this.
  8. UnityUser9860

    UnityUser9860

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

    Driiade

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

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    289
    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:
    535
    The solution is here, and here is an example of the loopback packets capturing.
     
  12. Pidon

    Pidon

    Joined:
    Dec 8, 2015
    Posts:
    8
    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.