Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.3   8.4   8.5   9.0   9.1   9.2   9.3   9.4   9.5   10.0    Statistic  

SystemInfo.NetworkStats

Queries network statistics for link layer on MacOS.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SystemInfo 10.0 Yes No Yes, macOS only No No
MBS( "SystemInfo.NetworkStats"; Name )   More

Parameters

Parameter Description Example value
Name The name of the interface to query.
Can be empty for array of all interfaces.
Pass "sum" to sum up all counters.
"en0"

Result

Returns OK or error.

Description

Queries network statistics for link layer on MacOS.
Returns JSON array of objects, each with the following keys:

Name, PhysicalType, Type, MTU, Baudrate, InputPackets, InputErrors, OutputPackets, OutputErrors, Collisions, InputBytes, OutputBytes, InputMulticasts, OutputMulticasts.

Type is the type of device which includes 1 for ethernet and 6 for Wifi.

BaudrateThe linespeed.
CollisionsThe number of collisions on csma interfaces.
InputBytesTotal number of octets received.
InputErrorsThe number of input errors on interface.
InputMulticastsThe number of packets received via multicast.
InputPacketsThe number of packets received.
MTUThe maximum transmission unit.
NameThe name of the interface.
OutputBytesTotal number of octets sent.
OutputErrorsThe number of output errors.
OutputMulticastsThe number of packets sent via multicast.
OutputPacketsThe number of packets sent.
PhysicalTypeThe physical network type. e.g., AUI, Thinnet, 10base-T, etc
TypeThe network type.

Examples

Query statistics for all interfaces:

MBS( "SystemInfo.NetworkStats" )

Example result:
[
  {
    "Name":   "lo0",
    "PhysicalType":   24,
    "Type":   24,
    "MTU":   16384,
    "Baudrate":   0,
    "InputPackets":   1211504,
    "InputErrors":   0,
    "OutputPackets":   1211504,
    "OutputErrors":   0,
    "Collisions":   0,
    "InputBytes":   424215552,
    "OutputBytes":   424215552,
    "InputMulticasts":   866700,
    "OutputMulticasts":   0
  },
  ...
]

Query statistics for en0, first ethernet card:

MBS( "SystemInfo.NetworkStats"; "en0" )

Example result:
{
  "Name":   "en0",
  "PhysicalType":   6,
  "Type":   6,
  "MTU":   1500,
  "Baudrate":   112050000,
  "InputPackets":   3349997,
  "InputErrors":   0,
  "OutputPackets":   9122258,
  "OutputErrors":   28815,
  "Collisions":   0,
  "InputBytes":   2294099968,
  "OutputBytes":   9673651200,
  "InputMulticasts":   67811,
  "OutputMulticasts":   0
}

Query sum of statistics:

MBS( "SystemInfo.NetworkStats"; "sum" )

Example result:
{
  "Name":   "sum",
  "InputPackets":   3393156,
  "InputErrors":   0,
  "OutputPackets":   9154972,
  "OutputErrors":   29387,
  "Collisions":   0,
  "InputBytes":   2303736832,
  "OutputBytes":   9682581504,
  "InputMulticasts":   88721,
  "OutputMulticasts":   0
}

Blog Entries

Created 3th December 2019, last changed 4th December 2019


SystemInfo.MacVRAMSize   -   SystemInfo.OSName

Feedback: Report problem or ask question.




Links
MBS Xojo blog