# How to get total bytes transferred by stream?

**URL:** <https://community.wowza.com/t/how-to-get-total-bytes-transferred-by-stream/39539>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [November 20, 2012, 2:10pm UTC](https://community.wowza.com/t/how-to-get-total-bytes-transferred-by-stream/39539 "2012-11-20T14:10:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_lappo](https://avatars.discourse-cdn.com/v4/letter/i/49beb7/32.png) [@Ivan\_lappo](https://community.wowza.com/u/Ivan_lappo)\
**Post date:** [November 20, 2012, 2:10pm UTC](https://community.wowza.com/t/how-to-get-total-bytes-transferred-by-stream/39539/1 "2012-11-20T14:10:55Z")

</div>

I need to collect statistics of usage and total bytes send and received by server. I suppose, in MediaEventListener.onStop() should be some way, to get total bytes transferred by stream.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [November 20, 2012, 1:59pm UTC](https://community.wowza.com/t/how-to-get-total-bytes-transferred-by-stream/39539/2 "2012-11-20T13:59:08Z")

</div>

You can use IOPerformanceCounter in the IMediaStreamActionNotify.onStop() handler:

```auto
public void onStop(IMediaStream stream)
{
	IOPerformanceCounter perf = stream.getMediaIOPerformance();
	getLogger().info("Total OutBytes: " + perf.getMessagesOutBytes());
}

```

But the best way is look at log files. Look at the sc-bytes (server to client bytes) in rows with x-event “destroy”

Richard

---

<div class="post-metadata">

**Author:** ![Ivan\_lappo](https://avatars.discourse-cdn.com/v4/letter/i/49beb7/32.png) [@Ivan\_lappo](https://community.wowza.com/u/Ivan_lappo)\
**Post date:** [November 29, 2012, 1:17pm UTC](https://community.wowza.com/t/how-to-get-total-bytes-transferred-by-stream/39539/3 "2012-11-29T13:17:47Z")

</div>

thanks. It was helpful.

---

<div class="post-metadata">

**Author:** ![Joao\_Bruno\_Abou\_Hate](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Joao\_Bruno\_Abou\_Hate](https://community.wowza.com/u/Joao_Bruno_Abou_Hate)\
**Post date:** [January 2, 2015, 2:45pm UTC](https://community.wowza.com/t/how-to-get-total-bytes-transferred-by-stream/39539/4 "2015-01-02T14:45:59Z")

</div>

> You can use IOPerformanceCounter in the IMediaStreamActionNotify.onStop() handler:
> 
> ```auto
> public void onStop(IMediaStream stream)
> {
> IOPerformanceCounter perf = stream.getMediaIOPerformance();
> getLogger().info("Total OutBytes: " + perf.getMessagesOutBytes());
> }
> 
> ```
> 
> But the best way is look at log files. Look at the sc-bytes (server to client bytes) in rows with x-event “destroy”
> 
> Richard

Hi Richard,

Does this method work also for HTTP-based stream protocols? I’m having trouble calculating the amount of bytes sent to a single user through a DASH-MPEG stream.
