Getting Network Packets Data

Discussion in 'Mac Programming' started by ruhi, Nov 16, 2009.

  1. ruhi macrumors member

    Jun 17, 2009

    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.

  2. savar macrumors 68000


    Jun 6, 2003
    District of Columbia
    Packet Peeper does exactly that, and its open source.
  3. cqexbesd macrumors regular

    Jun 4, 2009
    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.


  4. Cromulent macrumors 603


    Oct 2, 2006
    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 :)).
  5. chown33 macrumors 604

    Aug 9, 2009
    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.

    Interachy does much more than view traffic. You can ignore those features.
  6. ehunt123 macrumors newbie

    Dec 7, 2009
    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

Share This Page