Monitor Network Traffic Mac

2020-06-04 03:16发布

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.

4条回答
Explosion°爆炸
2楼-- · 2020-06-04 03:21

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

查看更多
forever°为你锁心
3楼-- · 2020-06-04 03:31

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.

查看更多
够拽才男人
4楼-- · 2020-06-04 03:45

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

查看更多
Lonely孤独者°
5楼-- · 2020-06-04 03:46

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
查看更多
登录 后发表回答