F_ScanIPv4AddrIds

F_ScanIPv4AddrIds 1:

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

F_ScanIPv4AddrIds 2: 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)
and sIPv4 ≠ '0.0.0.0'

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 *)
 

Requirements

Development environment

Target system type

PLC libraries to include (Category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_System (System)