FP_IPV4_GET_CONNECTION_ESTABLISHED

Return the IPv4 connection parameters

This FP instruction returns the connection parameters of an IPv4 connection. Which connection parameters are returned depends on whether the connection has been established or not.

Input

nPort (WORD, INT, UINT)

Ethernet port on CPU (FP7 E types):

SYS_ETHERNET_USER_CONNECTION_1SYS_ETHERNET_USER_CONNECTION_216

Output

dutIPv4ConnectionStatus (FP_IPv4_CONNECTION_STATUS_DUT)

Parameters of the Ethernet connection

Elements of the DUT (identifiers):

Data type

With connection established

Without connection established

IPv4 Array[0..3] OF WORD

IP address in Internet protocol version 4 format

IP address in Internet protocol version 4 format

SubnetMask Array[0..3] OF WORD

Subnet mask

Subnet mask

DefaultGateway Array[0..3] OF WORD

Default gateway

Default gateway

wHomePortNumber WORD

Number of the home port

0
wDestIPAddressType Array[0..3] OF WORD

Address type of destination IP address

Address type of destination IP address

IPv4Dest Array[0..3] OF WORD

Address type of destination IP address

Address type of destination IP address

wDestPortNumber WORD

Destination IP address in Internet protocol version 4 format

0

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

VAR
		dutConnectionStatusEstablished: FP_IPv4_CONNECTION_STATUS_DUT;
		bGetConnectionEstablished: BOOL:=FALSE;
		@'': @'';
	END_VAR

LD body

When the variable bGetConnectionEstablished is set to TRUE, the function is carried out.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 7 ;
        NETWORK_BODY
B(B_VARIN,,SYS_ETHERNET_USER_CONNECTION_1,21,2,23,4,);
B(B_VAROUT,,dutConnectionStatusEstablished,43,2,45,4,);
B(B_CONTACT,,bGetConnectionEstablished,6,1,8,3,);
B(B_F,FP_IPV4_GET_CONNECTION_ESTABLISHED!,,23,0,43,4,,?DEN?DnPort?AENO?CdutIPv4ConnectionStatus);
L(8,2,23,2);
L(1,2,6,2);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF (bGetConnectionEstablished) THEN
    FP_IPV4_GET_CONNECTION_ESTABLISHED(nPort := SYS_ETHERNET_USER_CONNECTION_1,
    dutIPv4ConnectionStatus => dutConnectionStatusEstablished);
END_IF;

Modified on: 2022-01-18Feedback on this pagePanasonic hotline