host ipaddr - part-cw/lambdanative GitHub Wiki
(host-ipaddr . name)
host-ipaddr returns host ip4 address as a u8vector, or #f. If more than one address is associated with the host, only the first entry in the address list will be returned.
Parameter | Description |
---|---|
name | Optional: Hostname to resolve |
Example
Example 1: Get my machine's ip address, with an internet connection present
> (ipaddr->string (host-ipaddr "localhost"))
"192.168.31.2"
Example 2: Get my machine's ip address, without internet connection available
> (ipaddr->string (host-ipaddr "localhost"))
"127.0.0.1"