netGetStatistics (Functionblock) |
|
This returns the current statistics for a network interface. Depending on the kind of interface and the status, some variables may be empty. The variables will wrap around when reaching the max value(2147483647). This means that fast-growing values such as rx_bytes will turn negative when the max value is reached, which the application must handle. The statistics for some interfaces will be reset when the interface is opened or when the device is reset. netGetStatisticsAcc can be used to get statistics that does not automatically reset.
Input: iface : SINT The network interface to query. 1 = Cellular network, 2 = LAN network, etc. (See Network)
Output: status : SINT; 0 = No valid statistics found for this interface. The other fields have not been updated. 1 = The statistics are valid.
rx_packets : DINT The number of good packets received by the interface.
tx_packets : DINT The number of successfully sent packets.
rx_bytes : DINT The number of good received bytes.
tx_bytes : DINT The number of good transmitted bytes.
rx_dropped : DINT The number of packets received but not processed.
tx_dropped : DINT The number of packets dropped on their way to transmission.
rx_compressed : DINT The number of received compressed frames(Cellular only)
tx_compressed : DINT The number of transmitted compressed frames(Cellular only)
rx_errors : DINT The total number of bad packets received on this network. Sum of the following errors:
rx_length_errors : DINT The number of packets dropped due to invalid length.
rx_over_errors : DINT The number of packets dropped due to overflow.
rx_crc_errors : DINT The number of packets received with a CRC error.
rx_frame_errors : DINT Receiver frame alignment errors.
rx_fifo_errors : DINT Receive fifo error count.
rx_missed_errors : DINT The number of packets missed by the host.
tx_errors : DINT The total number of transmit problems. Sum of the following errors:
tx_aborted_errors : DINT The number of discarded frames.
tx_carrier_errors : DINT The number of frame transmission errors due to loss of carrier.
tx_fifo_errors : DINT The number of frame transmission errors due to FIFO underrun/underflow.
tx_heartbeat_errors : DINT The number of heartbeat errors.
tx_window_errors : DINT The number of frame transmission errors due to late collisions.
multicast : DINT The number of multicast packets received.
collisions : DINT The number of collisions during packet transmissions.
Declaration: Example: INCLUDE rtcu.inc |