net.local_ip
net.local_ip
功能
读取默认本机 IP。
语法
net.local_ip()
参数
无参数。
返回值
| 类型 | 说明 |
|---|---|
| String | 返回默认出口 IP;探测失败时返回 127.0.0.1。 |
示例
ip = net.local_ip() result = type(ip) // 输出:String print result
注意事项
- 通过 UDP 探测默认出口地址,不发送业务数据。
读取默认本机 IP。
net.local_ip()
无参数。
| 类型 | 说明 |
|---|---|
| String | 返回默认出口 IP;探测失败时返回 127.0.0.1。 |
ip = net.local_ip() result = type(ip) // 输出:String print result