Tom Irving
Tom Irving

Reputation: 10059

Monitor Network Traffic Mac

I'm wondering how to go about monitoring network traffic on my Mac. Like the way activity monitor does it, showing the bytes / packets in and out.

I know it's a bit vague, but I'm unsure of the best place to start.

EDIT: I'm wanting to do this in code, not use an existing piece of software.

Upvotes: 7

Views: 4082

Answers (4)

Sairam Krish
Sairam Krish

Reputation: 11681

There are lot of paid & freeware applications. But if you a command line person like me, Try this:

nettop //displays network usage per application with lot of details
nettop (press h) //displays help menu
nettop (press c) //collapse and display brief info on network usage

Upvotes: 0

Marcelo Cantos
Marcelo Cantos

Reputation: 185852

Use tcpdump for quick-n-dirty low-level command-line monitoring, and wireshark for the kitchen sink.

OTOH, if you just want to know the number of bytes/packets (as opposed to their contents), try Net Monitor, which is commercial, unfortunately.

Upvotes: 0

Tom Irving
Tom Irving

Reputation: 10059

I just found the open source project, MenuMeters. It's got exactly what I'm looking for.

Upvotes: 6

Josh
Josh

Reputation: 11070

You may want to look into programming with pcap. That's the library which drives tcpdump.

Upvotes: 3

Related Questions