Monitoring network usage excluding local traffic

前端 未结 8 2050
一整个雨季
一整个雨季 2020-12-29 13:14

I am working on an app that monitors network usage. However I noticed many ways to do this does not allow exclusion of local traffic (say, Time Machine).

I am lookin

8条回答
  •  北海茫月
    2020-12-29 13:55

    Don't know how to implement it in objective-c but the idea is that you get the address of the network you are in (you can figure this out from network class(A,B,C) based from your local ip or from bits in netmask if it's not standard), then just check the outgoing connection's address. If the destination is not in your local network, calculate traffic; if it's in, just do nothing.

提交回复
热议问题