![]() |
|
[C#] Measure bandwidth consumed by a single HttpClient WebRequest [C#] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Measure bandwidth consumed by a single HttpClient WebRequest [C#] (/showthread.php?tid=6077499) |
Measure bandwidth consumed by a single HttpClient WebRequest [C#] - draxyee - May 12, 2020 Anyone know how to do this? Cheers! RE: Measure bandwidth consumed by a single HttpClient WebRequest [C#] - Accord - May 12, 2020 Not sure if I get it correctly but wouldnt adding all this bytes be sufficient?? RE: Measure bandwidth consumed by a single HttpClient WebRequest [C#] - Shadow_Cloud - May 12, 2020 (May 12, 2020 09:52 PM)Accord Wrote: Not sure if I get it correctly but wouldnt adding all this bytes be sufficient?? Almost, but that would only be the down right? You would probably need to take the total size of the request and the total size of the response? RE: Measure bandwidth consumed by a single HttpClient WebRequest [C#] - draxyee - May 13, 2020 (May 12, 2020 09:52 PM)Accord Wrote: Not sure if I get it correctly but wouldnt adding all this bytes be sufficient?? Add the body and the headers and then get length of bytes? Would it be possible to give me an example? RE: Measure bandwidth consumed by a single HttpClient WebRequest [C#] - Shadow_Cloud - May 13, 2020 (May 13, 2020 08:22 AM)draxyee Wrote: Add the body and the headers and then get length of bytes? You should already have a Content-Length property on the objects? https://docs.microsoft.com/en-us/dotnet/api/system.net.webheadercollection?redirectedfrom=MSDN&view=netcore-3.1 https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.contentlength?redirectedfrom=MSDN&view=netcore-3.1#System_Net_HttpWebRequest_ContentLength RE: Measure bandwidth consumed by a single HttpClient WebRequest [C#] - draxyee - May 13, 2020 (May 13, 2020 08:31 AM)Shadow_Cloud Wrote: You should already have a Content-Length property on the objects? So how would I get the size of the webheader collection? Would I then add it to the size of content length? Cheers |