How to get Internet speed in macOS app

Hello,


Is there any way to get the "Internet speed / Network bandwidth" in macOS application?

My requirement is to find Internet speed (to know whether Network is slower / faster ).
  • I have checked CWWiFiClient.

With CoreWLAN apis we can retrieve : RSSI Value, Transmit speed etc.

Transmit Rate is an indication of the speed of your wireless network connection. Whether is it related with Internet speed ?
  • I want to know which parameters can be used to identify whether network is fast / slow?


Thanks. Any help is appreciated.
Identifying whether a network is fast or slow is a metric that you need to determine in your application. Evaluating the transmission rate for the Network you are connected to in CoreWLAN is one way to evaluate this but keep in mind that you should compare the transmitRate from CWWiFiClient with other metrics on the system to see where this number is at depending on the time it was last recorded. For example, you can compare this number against the macOS System Report. (Apple Log -> About This Mac -> System Report -> Wifi), and also with the maxRate and lastTxRate from the airport interface on the Terminal.

As far as the transmission per-app you can take a look at measuring per-connection metrics to get a better idea of where you're at. There's an iOS sample project that was created for collection connection metrics with NWConnection in Network Framework.

Collecting Network Connection Metrics
<https://developer.apple.com/documentation/network/nwconnection/collecting_network_connection_metrics>

I translated this to macOS and this project can be used as a starting point to get connection metrics inside you app. For macOS you should be able to just drop the ConnectionProbe class in your project and start extending it as needed.

I ran this probe on a connection and received the following results for TLS.

Connected in 0.059s
Resolved from cache in 0.012s
TLS took 0.036s


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Hello,

Thanks for your reply.

1: I have checked transmit Rate using CWWiFiClient and compared with the value from "airport tool" and "System Information".
This value is same at all the 3 places .

2: I am checking NWConnection in details to explore more.

<https://developer.apple.com/documentation/network/nwconnection/collecting_network_connection_metrics> link is not open with "Page not found" error.

Thanks.


You're right thanks for the heads up. It looks like the link was munged up when I added it to the post. Try this new inline link. If that gives you problems navigate out to the top level page of NWConnection and then scroll down to see the sample project Collecting Network Connection Metrics.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Thanks! Also trying to use this to figure out when a connection is available but packets are being dropped (i.e. super bad network). This happens pretty frequently amongst our retail user.s
How to get Internet speed in macOS app
 
 
Q