Main Content


Set multicast properties for communication with UDP socket

Since R2020b



    configureMulticast(u,address) subscribes the UDP socket u to the multicast group address address. This syntax sets the MulticastGroup property to address, the EnableMulticastLoopback property to true (the default), and the EnableMulticast property to true.

    This function is only supported on Windows®.


    configureMulticast(u,address,loopbackEnable) subscribes the UDP socket to the specified address, while the loopbackEnable property controls whether loopback is enabled. This syntax sets the EnableMulticastLoopback accordingly.


    configureMulticast(u,"off") clears the multicast configuration and related properties.


    collapse all

    Create a UDP socket and configure its multicast settings.

    Subscribe to a multicast address, allowing loopback.

    u = udpport;

    Subscribe to a multicast address, but ensure that the UDP socket does not receive the data that it sends to the multicast group.


    Unsubscribe from the multicast group.


    Input Arguments

    collapse all

    UDP socket, specified as a udpport object.

    Example: u = udpport

    Data Types: udpport object

    Multicast group address to subscribe to, specified as a string or character vector.

    Example: ""

    Data Types: char | string

    Allow loopback reading by the UDP socket, specified as false or true. If you specify true, the UDP socket can receive messages that it sends to the multicast group, if the udpport socket sending the data is itself subscribed to the multicast group.

    Example: false

    Data Types: logical

    Version History

    Introduced in R2020b

    See Also