net
Module
Module Summary
Since
Description
This module provides an API for the network interface.
There is currently no support for Windows.
The content of this file is only valid if the system has been built with 'socket' (esock) support, which is the default.
Data Types
#{name := string(),
flags := [ifaddrs_flag()],
addr := socket:sockaddr(),
netmask := socket:sockaddr(),
broadaddr := socket:sockaddr(),
dstaddr := socket:sockaddr()}
This type defines all addresses (and flags) associated with the interface.
Not all fields of this map has to be present. The flags field can be used to test this for some of the fields. For example broadaddr will only be present if the broadcast flag is present in flags.
up | broadcast | debug | loopback | pointopoint | notrailers |
running | noarp | promisc | master | slave | multicast |
portsel | automedia | dynamic
#{family := default | inet | inet6 | packet | all,
flags := any | [ifaddrs_flag()]}
The 'default' value for family is interpreted as inet and inet6.
Also, the family field can only have the specified values (and not the all the values of socket:domain()).
The use of the flags field is that any flag provided must exist for the interface.
For example, if family is set to inet and flags to [broadcast, multicast] only interfaces address family inet and the flags broadcast and multicast will be listen.
Exports
Types
Returns the name of the current host.
OTP 22.0 |
OTP 22.0 |
Address-to-name translation in a protocol-independant manner.
This function is the inverse of getaddrinfo. It converts a socket address to a corresponding host and service.
OTP 22.0 |
OTP 22.0 |
OTP 22.0 |
OTP 22.0 |
Network address and service translation.
This function is the inverse of getnameinfo. It converts host and service to a corresponding socket address.
One of the Host and Service may be undefined but not both.
@OTP-16212@ |
@OTP-16212@ |
@OTP-16212@ |
@OTP-16212@ |
Types
Get interface addresses.
This function is used to get the machines interface addresses, possibly filtered with the FilterMap.
By default, a filter with the content: #{family => default, flags => any} is used. This will return all interfaces with adresses in the inet and inet6 families.
OTP 22.0 |
Mappings between network interface names and indexes.
OTP 22.0 |
Mappings between network interface index and names.
OTP 22.0 |
Types
Get network interface names and indexes.