Recommended Posts

Basically, I am looking to somehow run a command (even if it means using a program not built into Windows) to return the information in the screenshot below to a Command Prompt window.

post-176093-1187123254_thumb.png

I.e. I want to open CMD, type a command, and it return the amount of packets that have been sent and received.

Any help is much appreciated. I have tried Google; all I can find is GUI programs, and I need it to be command-line so I can use 'echo shell_exec("command");' in PHP to return the total amount of traffic cross-protocols. I'd use a HTTP bandwidth monitor, but that only takes into account the traffic the HTTP server uses, not the traffic that is used when being ran as a terminal server, RDC, a network access drive, etc.

Edit: After Googling for a bit, I have found that calculating how much data has passed through the network adapter is, by means of going by how many packets it says, is not an accurate way to do it. Can somebody verify or disprove this? If so, how can I measure it?

Edited by -Alex-
Link to comment
https://www.neowin.net/forum/topic/581021-network-bandwidth-in-cmd/
Share on other sites

netstat -e would give you what your looking for

C:\>netstat -e

Interface Statistics

Received Sent

Bytes 82694452 144932594

Unicast packets 207106 252805

Non-unicast packets 33522 115

Discards 0 0

Errors 0 0

Unknown protocols 204218

I've come across a big problem with this. I've written the script in PHP that tells me how much data I've transfered. Only problem with that, is that as soon as either sent or received data hits 4GB, it resets both counters back to zero, as described here. I need some way of either changing the 4GB to something huge (say 10TB) - which I don't think is possible - or, I need another command-line program that I can run that won't reset after 4GB.

Any suggestions?

a cheap alternative would be to store the last value read say 3.9GB then as the script goes to read the value again

if the new value is smaller then the old value then increase some counter by 1 and display that so your formula would be

$output = (counter * 4096) + newvalue;

printf($output . " MB transferred");

btw i don't code in php often so this may not be correct

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Is there anyone who did not see Microsoft extending updates for Windows 10? There are still ALOT of people who wont switch and it will become a security nightmare when they don't get security updates.
    • You need an MSA for the other two options as well (pay 1000 rewards points or $30). To me this reeks of desperation and defeat that they're not seeing W11 being adopted as quickly as they would like.
    • Where was this article in the Windows 8 era? Microsoft was thinking almost the same back then. Just look at the response they received with such thought process...
    • Hahaha! I've been arguing with my dad for 10 years (he's pro-Tesla, I'm impartial as I don't trust a lot of the people and their tech in these robotaxis) about this whole charade. His continued argument is the cost factor (economies of scale principle) and the associated technology (different dependencies of which reduced production cost is a potential outcome thus feeding into the reduced cost argument). And my rebuttal is the broad-market trust factor -- it's often not the most innovative or first-mover that wins (Uber and Tesla have been arguing/investing in autonomous vehicles forever) but rather the option that builds the most trust amongst the commonwealth. VW and Toyota are not the first or best or cheapest cars on the road, but they've built a long of continued trust to the scales of being the largest automakers by volume worldwide. Supercar makers have the highest profit margins, Tesla has the highest stock price, but VW and Toyota have the sales volumes. As it stands, the writing is on the wall... No matter what advantages Tesla had in their ambitions, they have an even-longer road to repair public trust than any other robotaxi provider (foreign or domestic). If the trend continues, everyone will realise that their market valuation is based on their non-automotive efforts (including not robotaxis or consumer humanoids).
    • Or just use Linux and live free. For the anti-Linux brigadiers reading this, this is the part where you go: Nooo! I love being digitally abused by Microsoft 😡😡 /s
  • Recent Achievements

    • Week One Done
      DrRonSr earned a badge
      Week One Done
    • Week One Done
      Sharon dixon earned a badge
      Week One Done
    • Dedicated
      Parallax Abstraction earned a badge
      Dedicated
    • First Post
      956400 earned a badge
      First Post
    • Week One Done
      davidfegan earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      601
    2. 2
      ATLien_0
      225
    3. 3
      Michael Scrip
      168
    4. 4
      +FloatingFatMan
      153
    5. 5
      Xenon
      137
  • Tell a friend

    Love Neowin? Tell a friend!