swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Other Library Functions  
function  

netutil.host-ip

 
 

Library: Network utilities (OMNETUTIL)
Import: omnetutl.xmd
Return type: String

Returns: The IP address of a host computer given its name.


Declaration

define external stream function netutil.host-ip
   of value string Host-Name optional

Argument definitions

Host-Name
is the name of the host computer of which you want to retrieve the IP address.


Purpose

Use netutil.host-ip to retrieve the Internet Protocol (IP) address of a host computer, given its name.

Usage Notes

The IP address is returned in dotted decimal format (for example, "127.0.0.1").

If no host name is specified, netutil.host-ip returns the IP address of the local host. If netutil.host-ip fails to retrieve the IP address, it returns netutil.invalid-ip which is defined as "255.255.255.255".

Examples

This sample gets IP address of the host whose host name or alias is specified.

  import "omnetutil.xmd" prefixed by netutil.
  
  process
    local stream host initial {"www.stilo.com"}
  
    output "The IP address of " || host
        || " is: " || netutil.host-ip of host
        || "%n"

This sample gets the IP address of the local host.

  import "omnetutil.xmd" prefixed by netutil.
  
  process
    output "The IP address of this machine is: "
        || netutil.host-ip
        || "%n"

      Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.