Resolve network host name or IP address
name = resolvehost(host)
name = resolvehost(host,"name")
address = resolvehost(host,"address")
[name,address] = resolvehost(host)
example
name = resolvehost(host) and name = resolvehost(host,"name") return the name of the specified host, where host is the network name or IP address.
name
host
address = resolvehost(host,"address") returns the address of the specified host.
address
[name,address] = resolvehost(host) returns both the name and address of the specified host.
collapse all
Provide an IP address to view the associated host name.
name = resolvehost("144.212.244.17")
name = 'www-ahprod.mathworks.com'
You can specify the optional input argument "name" as well.
"name"
name = resolvehost("144.212.244.17","name")
Specifying the host name instead returns the same host name.
name = resolvehost("www.mathworks.com")
name = 'www.mathworks.com'
Provide a network host name to view the associated IP address. You must include the input argument "address".
"address"
address = resolvehost("en.wikipedia.org","address")
address = '208.80.154.224'
Specifying the IP address instead returns the same IP address.
address = resolvehost("208.80.154.224","address")
You can view both the network name and IP address of a specified host. You can specify either the name or IP address. In this example, the resolvehost function returns the name and address from the provided host name.
resolvehost
[name,address] = resolvehost("en.wikipedia.org")
name = 'en.wikipedia.org'
You can also specify the IP address instead.
[name,address] = resolvehost("208.80.154.224")
name = 'text-lb.eqiad.wikimedia.org'
Network host name or IP address, specified as a character vector or string scalar.
Data Types: char | string
char
string
Network name, returned as a character vector.
IP address, returned as a character vector.
tcpclient | udpport
tcpclient
udpport
You have a modified version of this example. Do you want to open this example with your edits?