function
Library: Network utilities (OMNETUTL legacy)
Include: omnetutl.xin |
Returns: The IP of a host computer given its name. |
define external stream function NETGetHostIP By-Name value string Host-Name optional
Argument definitions
Use NETGetHostIP to retrieve the Internet Protocol (IP) address of a host computer, given its name.
You must include the following line at the beginning of your OmniMark program:
include "omnetutl.xin"
The IP address is returned in dotted decimal format (for example, "127.0.0.1").
If no host name is specified, NETGetHostIP
returns the IP address of the local host. If NETGetHostIP
fails to retrieve the IP address, it returns NETInvalidIP
which is defined as "255.255.255.255".
This sample gets the host IP given its name or name alias.
include "omnetutl.xin" process local stream host set host to "www.omnimark.com" output "ip of %g(host) is: <" || NETGetHostIP By-Name host || ">%n"
This sample gets the IP of the local host.
include "omnetutl.xin" process output "Local host ip is: <" || NETGetHostIP || ">%n"