setsourcefilter function (ws2tcpip.h)

The setsourcefilter inline function sets the multicast filter state for an IPv4 or IPv6 socket.

Syntax

int setsourcefilter(
  [in] SOCKET                 Socket,
  [in] ULONG                  Interface,
  [in] const SOCKADDR         *Group,
  [in] int                    GroupLength,
  [in] MULTICAST_MODE_TYPE    FilterMode,
  [in] ULONG                  SourceCount,
  [in] const SOCKADDR_STORAGE *SourceList
);

Parameters

[in] Socket

A descriptor that identifies a multicast socket.

[in] Interface

The interface index of the multicast interface.

[in] Group

A pointer to the socket address of the multicast group.

[in] GroupLength

The length, in bytes, of the socket address pointed to by the Group parameter.

[in] FilterMode

The multicast filter mode for the multicast group address.

[in] SourceCount

The number of source addresses in the buffer pointed to by the SourceList parameter.

[in] SourceList

A pointer to a buffer with the IP addresses to associate with the multicast filter.

Return value

On success, setsourcefilter returns NO_ERROR (0). Any nonzero return value indicates failure and a specific error code can be retrieved by calling WSAGetLastError.

Error code Meaning
WSAENOBUFS
Insufficient buffer space is available.
WSAENOTSOCK
The descriptor is not a socket.

Remarks

The setsourcefilter inline function is used to set the multicast filter state for an IPv4 or IPv6 socket.

This function is part of socket interface extensions for multicast source filters defined in RFC 3678. An app can use these functions to retrieve and set the multicast source address filters associated with a socket.

Windows Phone 8: This function is supported for Windows Phone Store apps on Windows Phone 8 and later.

Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.

Requirements

Requirement Value
Minimum supported client Windows 8.1, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header ws2tcpip.h
Library Ws2_32.lib
DLL Ws2_32.dll

See also

MULTICAST_MODE_TYPE

SOCKADDR_STORAGE

getipv4sourcefilter

getsourcefilter

setipv4sourcefilter