FB_init

Method FB_init : BOOL
VAR_INPUT
    sLocalHost                  : T_IPv4Addr;
    nLocalPort                  : UINT := 200;
    sSrvNetId                   : T_AmsNetId;
END_VAR


VAR_INPUT

sLocalHost: The Local IP address (IPv4) of the UDP socket as a string

nLocalPort: The local IP port number of the UDP socket. Default value is 200.

sSrvNetId: AMS Net Id. For the local computer (default) an empty string may be specified.

Variable nLocalPort is only for the socket that is used for the sending process. During the receiving process the port number must be 5568, other values will be ignored.

 

Example:

Declaration of the function block FB_UDP_CONNECTION:

PROGRAM MAIN
VAR
    fbUDP         : FB_UDP_CONNECTION (sLocalHost:= ‘192.168.1.100’, nLocalPort:= 200, sSrvNetId:= ‘’);
END_VAR