UdpClient.DropMulticastGroup 메서드

정의

멀티캐스트 그룹을 나갑니다.

오버로드

DropMulticastGroup(IPAddress)

멀티캐스트 그룹을 나갑니다.

DropMulticastGroup(IPAddress, Int32)

멀티캐스트 그룹을 나갑니다.

DropMulticastGroup(IPAddress)

Source:
UDPClient.cs
Source:
UDPClient.cs
Source:
UDPClient.cs

멀티캐스트 그룹을 나갑니다.

public:
 void DropMulticastGroup(System::Net::IPAddress ^ multicastAddr);
public void DropMulticastGroup (System.Net.IPAddress multicastAddr);
member this.DropMulticastGroup : System.Net.IPAddress -> unit
Public Sub DropMulticastGroup (multicastAddr As IPAddress)

매개 변수

multicastAddr
IPAddress

나갈 멀티캐스트 그룹의 IPAddress입니다.

예외

내부 Socket이 닫힌 경우

소켓에 액세스할 때 오류가 발생했습니다.

IP 주소가 소켓의 주소 지정 체계를 정의하는 AddressFamily 값과 호환되지 않는 경우

multicastAddr이(가) null인 경우

예제

다음 예제에서는 멀티캐스트 주소를 제공하여 멀티캐스트 그룹을 삭제하는 방법을 보여 줍니다.

// Send data to ClientTarget.
Console::WriteLine( "\nThe ClientOriginator sent:\n" );
Send::OriginatorSendData( clientOriginator, m_ClientTargetdest );

// Receive data from ClientTarget
Ret = Receive::ReceiveUntilStop( clientOriginator );

// Stop the ClientTarget thread
m_t->Abort();

// Abandon the multicast group.
clientOriginator->DropMulticastGroup( m_GrpAddr );

// Send data to ClientTarget.
Console.WriteLine("\nThe ClientOriginator sent:\n");
Send.OriginatorSendData(clientOriginator, m_ClientTargetdest);

// Receive data from ClientTarget
Ret = Receive.ReceiveUntilStop(clientOriginator);

// Stop the ClientTarget thread
m_t.Abort();

// Abandon the multicast group.
clientOriginator.DropMulticastGroup(m_GrpAddr);
' Send data to ClientTarget.
Console.WriteLine(ControlChars.Lf + "The ClientOriginator sent:" + ControlChars.Lf)
Send.OriginatorSendData(clientOriginator, m_ClientTargetdest)

' Receive data from ClientTarget
Ret = Receive.ReceiveUntilStop(clientOriginator)

' Stop the ClientTarget thread
m_t.Abort()

' Abandon the multicast group.
clientOriginator.DropMulticastGroup(m_GrpAddr)

설명

메서드는 DropMulticastGroup 지정된 IPAddressUdpClient 식별된 멀티캐스트 그룹에서 를 철회합니다. 메서드를 호출한 DropMulticastGroup 후 기본 Socket 은 라우터에 IGMP(인터넷 그룹 관리 프로토콜) 패킷을 보내고 멀티캐스트 그룹에서 라우터를 제거합니다. 가 UdpClient 그룹에서 철수하면 더 이상 해당 그룹으로 전송된 데이터그램을 받을 수 없습니다.

참고

가 수신되면 를 SocketException사용하여 SocketException.ErrorCode 특정 오류 코드를 가져옵니다. 이 코드를 가져온 후에는 Windows 소켓 버전 2 API 오류 코드 설명서에서 오류에 대한 자세한 설명을 참조할 수 있습니다.

추가 정보

적용 대상

DropMulticastGroup(IPAddress, Int32)

Source:
UDPClient.cs
Source:
UDPClient.cs
Source:
UDPClient.cs

멀티캐스트 그룹을 나갑니다.

public:
 void DropMulticastGroup(System::Net::IPAddress ^ multicastAddr, int ifindex);
public void DropMulticastGroup (System.Net.IPAddress multicastAddr, int ifindex);
member this.DropMulticastGroup : System.Net.IPAddress * int -> unit
Public Sub DropMulticastGroup (multicastAddr As IPAddress, ifindex As Integer)

매개 변수

multicastAddr
IPAddress

나갈 멀티캐스트 그룹의 IPAddress입니다.

ifindex
Int32

나갈 멀티캐스트 그룹의 로컬 주소입니다.

예외

내부 Socket이 닫힌 경우

소켓에 액세스할 때 오류가 발생했습니다.

IP 주소가 소켓의 주소 지정 체계를 정의하는 AddressFamily 값과 호환되지 않는 경우

multicastAddr이(가) null인 경우

예제

다음 코드 예제에서는 멀티캐스트 주소를 제공하여 멀티캐스트 그룹을 삭제하는 방법을 보여 줍니다.

// Send data to ClientTarget.
Console::WriteLine( "\nThe ClientOriginator sent:\n" );
Send::OriginatorSendData( clientOriginator, m_ClientTargetdest );

// Receive data from ClientTarget
Ret = Receive::ReceiveUntilStop( clientOriginator );

// Stop the ClientTarget thread
m_t->Abort();

// Abandon the multicast group.
clientOriginator->DropMulticastGroup( m_GrpAddr );

// Send data to ClientTarget.
Console.WriteLine("\nThe ClientOriginator sent:\n");
Send.OriginatorSendData(clientOriginator, m_ClientTargetdest);

// Receive data from ClientTarget
Ret = Receive.ReceiveUntilStop(clientOriginator);

// Stop the ClientTarget thread
m_t.Abort();

// Abandon the multicast group.
clientOriginator.DropMulticastGroup(m_GrpAddr);
' Send data to ClientTarget.
Console.WriteLine(ControlChars.Lf + "The ClientOriginator sent:" + ControlChars.Lf)
Send.OriginatorSendData(clientOriginator, m_ClientTargetdest)

' Receive data from ClientTarget
Ret = Receive.ReceiveUntilStop(clientOriginator)

' Stop the ClientTarget thread
m_t.Abort()

' Abandon the multicast group.
clientOriginator.DropMulticastGroup(m_GrpAddr)

설명

메서드는 DropMulticastGroup 지정된 IPAddressUdpClient 식별된 멀티캐스트 그룹에서 를 철회합니다. 메서드를 호출한 DropMulticastGroup 후 기본 Socket 은 라우터에 IGMP(인터넷 그룹 관리 프로토콜) 패킷을 보내고 멀티캐스트 그룹에서 라우터를 제거합니다. 가 UdpClient 그룹에서 철수하면 더 이상 해당 그룹으로 전송된 데이터그램을 받을 수 없습니다.

참고

을 수신하는 SocketException경우 속성을 사용하여 SocketException.ErrorCode 특정 오류 코드를 가져옵니다. 이 코드를 가져온 후에는 Windows 소켓 버전 2 API 오류 코드 설명서에서 오류에 대한 자세한 설명을 참조할 수 있습니다.

추가 정보

적용 대상