F_ScanIPv4AddrIds
The function F_ScanIPv4AddrIds converts a string with the (IPv4) Internet Protocol network address into single address bytes. The single address bytes are converted from left to right. They are returned as an array of bytes. The address bytes are represented in network byte order.
FUNCTION F_ScanIPv4AddrIds: T_IPv4AddrArr
Inputs
VAR_INPUT
sIPv4 : T_IPv4Addr;
END_VAR
Name | Type | Description |
---|---|---|
sIPv4 | T_IPv4AddrArr | Internet Protocol network address as a string (type: T_IPv4Addr). E.g. 172.16.7.199. |
Input parameters | Return parameter | Description |
---|---|---|
sIPv4 ≠ '' (empty string) | All bytes are null | Error during the conversion, check the formatting of the sIPv4 string. |
Example in structured text:
Internet Protocol (IPv4) network address string: '172.16.7.199' is converted to an array of address bytes.
PROGRAM MAIN
VAR
ids : T_IPv4AddrArr;
sIPv4 : T_IPv4Addr := '172.16.7.199';
END_VAR
ids := F_ScanIPv4AddrIds( sIPv4 ); (* Result: ids[0]:=172, ids[1]:=16, ids[2]:=7, ids[3]:=199 *)
Prerequisites
Development Environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.0 | PC or CX (x86, x64, Arm®) | Tc2_System (system) |