Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ruhi

macrumors member
Original poster
Jun 17, 2009
70
0
Hello,

I want to write a cocoa application which will capture the network packets on a particular port.

How can i implement that? Any help would me appreciable.

Thanks,
Ruhi.
 

cqexbesd

macrumors regular
Jun 4, 2009
175
42
Germany
I want to write a cocoa application which will capture the network packets on a particular port.

How can i implement that? Any help would me appreciable.

libpcap is the usual library used to do it from C. That will work for a Cocoa app though you migth find someone has done an ObjC wrapper already.

HTH,

Andrew
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
It depends how reliable you want the packet sniffer to be. If you just want to capture TCP packets before they reach the application then you can probably use the solutions provided.

If you want to capture raw packets as soon as they leave the hardware interface then you need to start mucking around with kernel extensions (which I am currently stuck with :)).
 

chown33

Moderator
Staff member
Aug 9, 2009
10,752
8,425
A sea of green
If you just want to view traffic using an existing app, Interarchy has a Traffic-viewing feature. You can limit it to a port, or it can show traffic on all ports.

http://www.interarchy.com/

Interachy does much more than view traffic. You can ignore those features.
 

ehunt123

macrumors newbie
Dec 7, 2009
7
0
If you're not a cli friend, going straight for TCPDump, there are quite a few front-ends around this.

Free ones, and the ones where the developer did a great job are the X11 port (bundled as an OSX app) of Wireshark, that is gigantic and amazing.

There is another one called CocoaShark or something. A simple search for sniffer on macupdate will get you there
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.