Microsoft DirectX 9.0


The implementation of this method is provided as sample code with the DirectShow SDK. It is not a supported DirectShow API.

The SetMulticastGroup method sets the multicast group that the filter will send or listen to.


HRESULT SetMulticastGroup(
  ULONG  ulIP,
  USHORT  usPort



[in]  Specifies the IP address, in network order (bytes ordered from left to right). You can use the inet_addr function to convert a standard dotted-format string (such as "") to the correct binary number.


[in] Specifies the port number, in TCP/IP network byte order. You can use the htons function to convert the port number to the correct byte order.

Return Values

This method returns an HRESULT value. Possible return codes include, but are not limited to, the values shown in the following table.

Value Description
E_INVALIDARG Invalid IP address.
E_UNEXPECTED The operation could not be performed because the filter is not stopped.
S_OK Success

Example Code

// Assign the multicast address, port 5000.
ULONG ulIP = inet_addr("");
USHORT usPort = htons(5000);
hr = pConfig->SetMulticastGroup(ulIP, usPort);

See Also