FB_SocketUdpAddMulticastAddress

FB_SocketUdpAddMulticastAddress 1:

Binds the server to a multicast IP address so that multicast packages can be received. This function block expects an already established UDP socket connection, which can be established via the function block FB_SocketUdpCreate.

FB_SocketUdpAddMulticastAddress 2: Inputs

VAR_INPUT
    sSrvNetId      : T_AmsNetId := '';
    hSocket        : T_HSOCKET;
    sMulticastAddr : STRING(15);
    bExecute       : BOOL;
    tTimeout       : TIME := T#5s;
END_VAR

Name

Type

Description

sSrvNetId

T_AmsNetId

String containing the network address of the TwinCAT TCP/IP Connection Server. For the local computer (default) an empty string may be specified.

hSocket

T_HSOCKET

Connection handle of the listener socket. This handle must first be requested via the function block FB_SocketUdpCreate.

sMulticastAddr

T_IPv4Addr

Multicast IP address to which the binding should take place.

bExecute

BOOL

The function block is enabled by a positive edge at this input.

tTimeout

TIME

Maximum time allowed for the execution of the function block.

FB_SocketUdpAddMulticastAddress 3: Outputs

VAR_OUTPUT
    bBusy     : BOOL;
    bError    : BOOL;
    nErrId    : UDINT;
END_VAR

Name

Type

Description

bBusy

BOOL

This output is active if the function block is activated. It remains active until acknowledgement.

bError

BOOL

If an error should occur during the transfer of the command, then this output is set once the bBusy output was reset.

nErrId

UDINT

If an bError output is set, this parameter returns the TwinCAT TCP/IP Connection Server error number.

Requirements

Development environment

Target system type

PLC libraries to include (category group)

TwinCAT v3.1.0

PC, or CX (x86, X64, Arm®)

Tc2_TcpIp (communication)