I want to write a program that monitors packets in and packets out, or in other words, 开发者_JAVA技巧network statistics. Is there any useful class in cocoa? I know there are some existed tools, but it will be a sub-routine of my program. So I must implement on my own.
Thanks a lot!
P.S. I only want to calculate one program / process 's statistics rather than the whole system.
You won't find much in Cocoa, you'll probably have to delve deeper into Core stuff. In the recently released pool of WWDC videos, they have a video on Core OS Networking that covers the Mac and iPhone platforms both, and gives a pretty good overview of some of the classes you might be needing to look at.
Might not hurt to give the Core Networking stuff a glance, since whatever you're monitoring is most likely using it: http://developer.apple.com/mac/library/documentation/Networking/Conceptual/CFNetwork/Introduction/Introduction.html
精彩评论