ResolveHostname (FB)
FUNCTION_BLOCK PUBLIC FINAL ResolveHostname EXTENDS ETrigTo
sHostname to an IIPAddress.The time out value has no effect for this function block.
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
myResolver : NBS.ResolveHostname;
sHostname : STRING := 'www.codesys.com';
myIPAddress : NBS.IPv4Address;
itfIPAddress : NBS.IIPAddress := myIPAddress;
udiCount : UDINT;
sIPAddress : NBS.IPADDRESS;
END_VAR
myResolver(
sHostname:=sHostname,
itfIPAddress:=itfIPAddress,
udiCount=>udiCount
);
IF myResolver.xExecute AND myResolver.xDone THEN
sIPAddress := myIPAddress.CompressedIP;
myResolver.xExecute := FALSE;
END_IF
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
xExecuteBOOLRising edge: Starts defined operationFALSE: Resets the defined operation after ready condition was reachedETrigTo
udiTimeOutUDINTMax. operating time for executing [µs], 0: No operating time limit
ETrigTo
Output
xDoneBOOLReady condition reached
ETrigTo
xBusyBOOLTRUE: Operation is runningETrigTo
xErrorBOOLTRUE: Error condition reachedETrigTo
eErrorIDETrigTo
Input Const
itfAsyncPropertyInput
sHostnameREFERENCE TO STRING
udiIndexUDINT0
Select a specific item, if more then one interface per hostname is avaiable
Inout
itfIPAddressOutput
udiCountUDINTThe number of possible IP addresses for the
sHostnamespecified
Methods:
ResolveHostname
SetInitialValue
SampleAction
Structure: