ResolveHostname.ResolveHostname (METH)ΒΆ
METHOD FINAL ResolveHostname : ERROR
Attempts to resolve the
sHostname
to an IIPAddress.If an IP address is already specified as a parameter, its format is checked.
Below is an example of how to handle the itfIPAddress
parameter.
It is necessary to assign an instance of NBS.IPv4Address
to a variable of type NBS.IIPAddress
.
VAR
eErrorID : NBS.ERROR;
myResolver : NBS.ResolveHostname;
sHostname : STRING := 'www.codesys.com';
myIPAddress : NBS.IPv4Address;
itfIPAddress : NBS.IIPAddress := myIPAddress;
udiCount : UDINT;
sIPAddress : NBS.IPADDRESS;
END_VAR
eErrorID := myResolver.ResolveHostname(
sHostname:=sHostname,
itfIPAddress:=itfIPAddress,
udiCount=>udiCount
);
IF eErrorID = NBS.ERROR.NO_ERROR THEN
sIPAddress := myIPAddress.CompressedIP;
END_IF
- InOut:
Scope
Name
Type
Initial
Comment
Return
ResolveHostname
Inout Const
sHostname
STRING
Input
udiIndex
UDINT
0
Select a specific item, if more then one interface per hostname is avaiable
Inout
itfIPAddress
Output
udiCount
UDINT
The number of possible IP addresses for the
sHostname
specified