TCPGetMyAddr

Command groupFlag affectedReversibleExecute on clientPlatform(s)
External commandsYESNONOAll

Syntax

TCPGetMyAddr
 
([socket 
{Default 0}
, ipv6 
{Default kFalse}
])
 
Returns 
address

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded,allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

TCPGetMyAddr is a domain name service command to resolve the IP address of the local computer running Omnis.

You can optionally pass a Socket, which corresponds to an open connection. In this case, the command returns the local IP address bound to the local endpoint of the connection. There are two cases where this is useful.

  1. It is not a mandatory requirement that a WinSock API implementation can return the local IP address, without a socket for an open connection. In this case it is likely that TCPGetMyAddr will return 0.0.0.0.
  2. If the local machine has more than one IP address, passing a socket eliminates ambiguity, and returns the local IP address used for the open connection.

Address is an Omnis Character field which receives the IP Address of the local host. The IP address is of the form 255.255.255.254

Possible error codes are listed in the Web Command Error Codes Appendix.

Example

# Return the IP address of this machine

TCPGetMyAddr
 
Returns 
lIPAddress

Quit method
 
lIPAddress