2 Replies
      Latest reply on Nov 10, 2016 4:04 AM by J-E-D
      J-E-D Level 1 Level 1 (0 points)

        I'm trying to build an application bandwidth controller for Mac OS 10.12 using swift.

        1) Already established that it has a built in application bandwidth monitor:  "nettop" (runs in terminal). It works fine and displays the bandwidth of each application in details.

        2) Also "Network link conditioner" (with GUI) is a downloadable tool to limit the bandwidth of the whole system.


        What I'm trying to do is build a software (preferably it has GUI) that limits the bandwidth consumption of 1 or more applications identified using nettop...




        Any proffessional or beginner notes would be greatly appreciated.

        thanks in advance,

        • Re: Application Bandwidth Controller
          eskimo Apple Staff Apple Staff (13,335 points)

          There are no high-level APIs for either side of this equation (monitoring or limiting network use).  If you'd like to see such APIs added in the future, I encourage you to file an enhancement request describing your requirements.  Please post your bug number, just for the record.

          You could probably make some progress with an NKE (see the Network Kernel Extensions Programming Guide) but KEXT development presents some serious challenges:

          • Swift is not supported in the kernel, so your KEXT would have to be written in C or C++.

          • Deploying a KEXT requires special permission from Apple.  See the Requesting a Certificate for Your Kext section of the Developer ID page for details.

          • KEXT development is hard; any mistake in your KEXT will take down the entire machine.

          In addition to all of the difficulties with KEXT development in general, actually implementing these features is not easy.  To start, you’d need a socket filter to track per-app usage but an IP filter to track and manage bandwidth.  In addition, managing bandwith requires some gnarly TCP state machine tracking.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          1 of 1 people found this helpful
            • Re: Application Bandwidth Controller
              J-E-D Level 1 Level 1 (0 points)

              Thanks eskimo for the response!

              1st, I don't have any problems and therefore not encountering any bugs to report.

              2nd, I really don't know the request protocol and don't have sufficient details to include in it.


              So if you really believe my request will benefit MAC OS, and as you're a certified person within the apple community, I think it would be more effective if you filed it youself.

              Simply a program, utility, or script that uses Nettop ability to perform a Network link conditioner task on specific application(s) running on the system.

              Please let me know if you decide to go through with the request.

              Thanks again, take care