Getting Status of NET


To get a status of the NET port, get command of pid_ioctl function is required.

$return = pid_ioctl($pid, "get ITEM");

ITEM is a name of available states.

Available NET States

ITEM Description Return Value Return Type
hwaddr MAC Address e.g. 00:30:f9:00:00:01 string
ipaddr IP Address e.g. 10.1.0.1 string
netmask Subnet Mask e.g.) 255.0.0.0 string
gwaddr Gateway Address e.g. 10.1.0.254 string
nsaddr Name Server Address e.g. 10.1.0.254 string
mode 10M Ethernet 10BASET string
100M Ethernet 100BASET string
WLAN Unavailable ""(an Empty String) string
WLAN Infrastructure INFRA string
WLAN Ad-hoc IBSS string
WLAN Soft AP AP string
speed Ethernet Speed[Mbps] 0 / 10 / 100 integer
WLAN Speed[100Kbps] 0 / 10 / 20 / 55 / 110 / 60 / 90 / 120
/ 180 / 240 / 360 / 480 / 540
integer

example of getting NET states

This example checks and prints various states of NET.

<?php
$pid = pid_open("/mmap/net1");               // open NET 1
echo pid_ioctl($pid, "get hwaddr"), "\r\n";  // get MAC address
echo pid_ioctl($pid, "get ipaddr"), "\r\n";  // get IP address
echo pid_ioctl($pid, "get netmask"), "\r\n"; // get subnet mask
echo pid_ioctl($pid, "get gwaddr"), "\r\n";  // get gateway address
echo pid_ioctl($pid, "get nsaddr"), "\r\n";  // get name server address
echo pid_ioctl($pid, "get mode"), "\r\n";    // get WLAN mode
echo pid_ioctl($pid, "get speed"), "\r\n";   // get WLAN speed
pid_close($pid);                             // close NET 1
?>