sockIPFromName (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


Makes a 32 bit IP address out of a dotted format like "80.62.33.111". It can also resolve a symbolic name like "logicio.com".

 

Note: when the default network interface is selected, the sockIPFromName function will try to resolve the symbolic name using the first connected network. The sockIPFromName function will look for a connected network, starting with Mobile network and working up. (LAN1 network, then LAN 2 network, etc.)

 

 

Input:

str : STRING

IP address (in dotted format "aaa.bbb.ccc.ddd" or symbolic "domain.xyz").

 

iface : SINT (default 0)

The network interface to use. 0 = Default, 1 = Mobile network, 2 = LAN network, etc. (See Network)

 

 

Returns: DINT

32 bit IP address. 0 will be returned if address cannot be resolved.

 

 

Declaration:

FUNCTION sockIPFromName : DINT;
VAR_INPUT
  str   : STRING;   // IP address (aaa.bbb.ccc.ddd or "domain.xxx")
  iface : SINT := 0; // Interface to resolve on
END_VAR;

 

 


Example:

 

Please see the "Examples - Socket Communication"