确认NET状态信息


利用pid_ioctl函数的get命令可确认NET端口的状态信息。

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

ITEM是可进行确认的状态信息的名称。

可确认的NET状态信息

ITEM 说明 返还值 返还类型
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

NET状态信息确认 例

此例子确认NET的各状态信息并输出

$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