Take a look at libpcap.  Its what drives most capture software out there.  I 
have no idea if there is anything equivalent to it in OSX’s abstraction layers 
but you should be able to integrate by adding libpcap in to your project.  
You’ll need to add in the appropriate sockets header files as well.

--
Jeremy Thompson
Sports Warehouse Inc.
[email protected]




> On Jun 8, 2015, at 10:12 PM, Fabian Jäger <[email protected]> 
> wrote:
> 
> As Tom is also pointing out, I was looking for a way to programmatically do 
> this in my application.
> Sorry for not being specific enough in the first place.
> 
> Best regards,
> Fabian
> 
> 
>> On 09 Jun 2015, at 01:37, Tom Marchand <[email protected]> wrote:
>> 
>> Although this won’t fit the original poster’s needs as he is looking to 
>> implement this functionally in software, the following works very well:
>> 
>> netstat -b -I <device>
>> 
>> 
>> On Jun 8, 2015, at 6:43 PM, Jeff Meegan <[email protected]> wrote:
>> 
>>> If all you want are counters, I’d probably just enable
>>> snmp on the host and periodically snmpget ifInOctets and ifOutOctets,
>>> etc.  http://www.net-snmp.org/docs/mibs/interfaces.html  has a good
>>> overview of the Interface MIB so you can see what kind of data you
>>> have access to.  This is pretty scriptable, too.
>>> 
>>> —j
>>> 
>>>> On Jun 8, 2015, at 3:36 PM, Peter Lovell <[email protected]> wrote:
>>>> 
>>>> Another suggestion - see if you can find or borrow on old-style "ethernet 
>>>> hub". Not the more modern "switch" variety, but an old-fashioned hub - the 
>>>> kind that broadcast all traffic on all its ports.
>>>> 
>>>> If you can get one of these then you can put your traffic-collector on a 
>>>> separate machine and that way the monitoring doesn't interfere with the 
>>>> activity.
>>>> 
>>>> Jeremy's recommendation of tcpdump/Wireshark is right on target.
>>>> 
>>>> Cheers.....Peter
>>>> 
>>>> 
>>>> Jeremy Thompson <[email protected]> wrote:
>>>> 
>>>>> There are a couple of things you will need to do whether you use tools
>>>>> to capture information or write your own code.  The device will need to
>>>>> have some sort of shell access and tools built in to packet capture.  If
>>>>> its a OS X, BSD, Linux machine you will be able to use tcpdump.  You can
>>>>> send that capture to a file and process with a tool.  I would recommend
>>>>> Wireshark.  Wireshark can capture as well but if the machine can't run
>>>>> it or doesn't have a gui you will need to capture and then process on
>>>>> your machine.  If the device is fairly locked down you'll need to mirror
>>>>> the switch port its connected to.  On the mirrored port you can use
>>>>> Wireshark, tcpdump, or your own code to do a capture.
>>>>> 
>>>>> --
>>>>> Jeremy Thompson
>>>>> Sports Warehouse Inc.
>>>>> [email protected]
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>> On Jun 8, 2015, at 1:35 PM, Fabian Jäger
>>>>> <[email protected]> wrote:
>>>>>> 
>>>>>> Dear experts,
>>>>>> is it possible to monitor the inbound/outbound traffic of a particular
>>>>> network device? I would like to print some statistics and would need the
>>>>> byte/s information...
>>>>>> 
>>>>>> Best regards,
>>>>>> Fabian
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Macnetworkprog mailing list      ([email protected])
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> https://lists.apple.com/mailman/options/macnetworkprog/jeremy
>>>>> %40warehousesports.com
>>>>>> 
>>>>>> This email sent to [email protected]
>>>>> 
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Macnetworkprog mailing list      ([email protected])
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> https://lists.apple.com/mailman/options/macnetworkprog/plovell%40mac.com
>>>>> 
>>>>> This email sent to [email protected]
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Macnetworkprog mailing list      ([email protected])
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/macnetworkprog/jeffm%40frob.org
>>>> 
>>>> This email sent to [email protected]
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Macnetworkprog mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/macnetworkprog/tpmarchand%40gmail.com
>>> 
>>> This email sent to [email protected]
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Macnetworkprog mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/macnetworkprog/fabian.jaeger%40chungwasoft.com
>> 
>> This email sent to [email protected]
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/macnetworkprog/jeremy%40warehousesports.com
> 
> This email sent to [email protected]

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to