# LGF_StringToTaddr (FC / V3.0.1)

Author: Siemens Digital Industry

## Short description

The system data type `TADDR_Param` contains address information consisting of an IPV4 address and the port number.

The `LGF_StringToTaddr` function converts a variable od data type `String` to a `TADDR_Param` system data type variable.

### Block Interface

| LGF_StringToTaddr (FC) |
--- | --- | ---
String |  |  | ipAddressString |  | Ret_Val |  |  | TADDR_Param
|  |  |  |  | error |  |  | Bool
|  |  |  |  | status |  |  | Word

### Input parameter

Identifier | Data type | Description
--- | --- | ---
ipAddressString | String | IPV4 address string in the format of `192.168.1.200:55047` [Port number including colon `:` is optional]

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | TADDR_Param | IP-Address and Port number as `TADDR_Param` data type
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_FINISHED_NO_ERROR Status: Execution finished without errors
16#8110 | ERR_OCTET_WRONG_NUMBER_OF_CHAR Error: Wrong number / too many characters in the X'th octet of the IP address
16#8120 | ERR_OCTET_STRING_IS_EMPTY Error: No number/ character in the X'th octet of the IP address is given - String is empty
16#8130 | ERR_OCTET_EXCEEDS_MAX_IP_ADDRESS Error: Maximum possible number of IP address octet exceeded (255)
16#8150 | ERR_PORT_WRONG_NUMBER_OF_CHAR Error: Wrong number / to many characters in string port conversion
16#8151 | ERR_PORT_STRING_IS_EMPTY Error: No number/ character in the Port string is given - String is empty
16#8152 | ERR_PORT_EXCEEDS_MAX_PORT Error: Maximum number of Port exceeded (65535)

## Functional description

The function converts the IPV4 address with or without port number from data type `String` to `TADDR_Param`.
The string must be in the following form:

- without port number: `[0..255].[0..255].[0..255].[0..255]`
- with port number: `[0..255].[0..255].[0..255].[0..255]:[0..65535]`

####### Example:

- The standard string format for an IPV4 address without port number:
  `192.168.11.11`
- The standard string format for an IPV4 address with port number:
  `192.168.11.11:3294`

Note
  If you do not specify a port number in the `ipAddressString` parameter, the `Ret_Val.REM_PORT_NR` parameter returns `0`.

## Change log

Version & Date | Change description
--- | ---
| 01.00.00 | Siemens Industry Online Support
| 30.01.2017 | First released version
| 01.00.01 | Siemens Industry Online Support
| 17.08.2018 | Upgrade: TIA V15 Update 2
| 01.00.02 | Siemens Industry Online Support
| 23.11.2018 | Upgrade: TIA V15.1
| 01.00.03 | Simatic Systems Support
| 10.06.2019 | Standard header and block parameters update
| 01.00.04 | Simatic Systems Support
| 10.07.2019 | Code refactoring and performance improvements
| 01.00.06 | Simatic Systems Support
| 14.11.2019 | Add ENO handling
| 03.00.00 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0 Harmonize the version of the whole library
| 03.00.01 | Simatic Systems Support
| 23.02.2021 | Insert documentation