Tanner Silva
Tanner Silva

Reputation: 279

Monitor Incoming Bytes OS X

I am building a network utility for OS X. I've gone through Apples documentation, but I cannot find the framework that allows my app to monitor incoming bytes. Can anybody point me in the right direction? Thank you for your time!

Upvotes: 0

Views: 523

Answers (3)

Brian Campbell
Brian Campbell

Reputation: 332816

To get statistics on a network, you can use the sysctl system call. This is fairly thinly documented; there's another answer on StackOverflow that gives a brief example, and for more detail, I'd recommend looking at the netstat source code.

Upvotes: 1

Adam Rosenfield
Adam Rosenfield

Reputation: 400234

You can use libpcap, which is a portable library for doing packet captures used by tcpdump, Wireshark, and more. It's not an official Apple library, but it's BSD-licensed so you shouldn't have any problem using it.

Upvotes: 0

cb0
cb0

Reputation: 8613

I think for something like this could be done with

http://www.wireshark.org/ or http://www.tastycocoabytes.com/cpa/

In Linux you could simply listen to the file that is associated with your network card.

But I don't think this can be done an easy way on OS X. But indeed there must be some way, thinking of LittleSnitch.

Upvotes: 0

Related Questions