Monitor Network Traffic Mac

[亡魂溺海] 提交于 2019-12-04 11:31:55

问题


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.


回答1:


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




回答2:


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




回答3:


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:


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


来源:https://stackoverflow.com/questions/2662332/monitor-network-traffic-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!