Retrieve a description of the connection open through the network interface
Device
Table — connection configuration information
This method returns a table which details the interface’s currently open connection. This table currently contains a single key, ipv4, whose value is itself a table containing the following primary keys:
Key | Type | Notes |
---|---|---|
address | String | The imp’s IP address, eg. "192.168.0.3" |
broadcast | String | The network router’s broadcast IP address eg. "192.168.0.255" |
dhcpserver | String | The DHCP server’s IP address, or absent if the imp has a static IP address |
dnsserver | Array | One or two DNS server addresses each in "www.xxx.yyy.zzz" form |
gateway | String | The network’s gateway IP address eg. "192.168.0.1" |
netmask | String | The network’s mask eg. "255.255.255.0" |
proxy | Table | A proxy server’s details (see below), or absent if no proxy has been set (with imp.setproxy()) |
server | Table | The imp server’s connection details (see below) |
Note Any field in the above and following tables that provides a dotted quad value – for example, the address field in this ipv4 table – is optional in as much as it will not be included in the table if the value is determined to be 0.0.0.0
. You should always test for the presence of any such a key in the returned table (for instance, if ("address" in interface.getiptable()) {...}
) or embed your lookup code in a try...catch
structure.
The ipv4 table’s proxy key’s value, if present, is itself a table with the following keys:
proxy Key | Type | Notes |
---|---|---|
address | String | The proxy’s IP address, eg. "192.168.0.2" |
port | Integer | The proxy’s port, eg. 80 |
type | Integer | The proxy type (see imp.setproxy()) |
user | String | The proxy username, when configured |
The ipv4 table’s server key’s value is a table with the following keys:
server Key | Type | Notes |
---|---|---|
errorpolicy | Integer | SUSPEND_ON_ERROR or RETURN_ON_ERROR |
port | Integer | The server’s port, eg. 31314 |
tcpsendwindow | Integer | TCP window size in bytes |
tcptimeout | Float | Timeout in seconds |
tcpwaitfor | Integer | WAIT_TIL_SENT or WAIT_FOR_ACK |
Note This information mirrors the ipv4 table included in the data returned by imp.net.info().