User Tools

Site Tools


uphp:functions:getethstat

getethstat

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Get Ethernet connection status information

Description

array getethstat ( )

Return an array containing information on the status of the LAN interface

Parameters

None

Return Values

Array containing the following keys and values:

KEYTYPEVALUE
RXintNumber of bytes received
TXintNumber of bytes transmitted
RXPKTintNumber of packets received
TXPKTintNumber of packets transmitted
connectedint1 if currently connected, 0 if disconnected
ip_addressstringCurrent IP address (if connected)
gatewaystringCurrent gateway address (if connected)
DNSstringCurrent DNS address (if connected)

Example

<pre><?
  $arr=getethstat();
  if ($arr['connected']) {
    print("Ethernet is currently connected\r\n");
  } else {
    print("Ethernet is NOT currently connected\r\n");
  print_r($arr);
  }
?></pre>

Typical output for the above example (results vary depending on the status of the connection):

Ethernet is currently connected
[$arr] = Array (
(int) [RX] => 11134469
(int) [TX] => 19102145
(int) [RXPKT] => 536579
(int) [TXPKT] => 174112
(int) [connected] => 1
(string) [ip_address] => 90.0.0.126
(string) [gateway] => 90.0.0.1
(string) [DNS] => 90.0.0.1
) 

See Also

setethpower() - Enable or disable the ethernet controller

get3gstat() - Get cellular data connection status information

uphp/functions/getethstat.txt · Last modified: 2021/09/13 05:57 (external edit)