本文整理汇总了C#中System.Net.Sockets.IPv6MulticastOption.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IPv6MulticastOption.ToString方法的具体用法?C# IPv6MulticastOption.ToString怎么用?C# IPv6MulticastOption.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Sockets.IPv6MulticastOption
的用法示例。
在下文中一共展示了IPv6MulticastOption.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setIPv6MulticastOption
/// <devdoc>
/// <para>
/// IPv6 setsockopt for JOIN / LEAVE multicast group
/// </para>
/// </devdoc>
private void setIPv6MulticastOption(SocketOptionName optionName, IPv6MulticastOption MR) {
IPv6MulticastRequest ipmr = new IPv6MulticastRequest();
ipmr.MulticastAddress = MR.Group.GetAddressBytes();
ipmr.InterfaceIndex = unchecked((int)MR.InterfaceIndex);
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::setIPv6MulticastOption(): optionName:" + optionName.ToString() + " MR:" + MR.ToString() + " ipmr:" + ipmr.ToString() + " IPv6MulticastRequest.Size:" + IPv6MulticastRequest.Size.ToString());
// This can throw ObjectDisposedException.
SocketError errorCode = UnsafeNclNativeMethods.OSSOCK.setsockopt(
m_Handle,
SocketOptionLevel.IPv6,
optionName,
ref ipmr,
IPv6MulticastRequest.Size);
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::setIPv6MulticastOption() UnsafeNclNativeMethods.OSSOCK.setsockopt returns errorCode:" + errorCode);
//
// if the native call fails we'll throw a SocketException
//
if (errorCode==SocketError.SocketError) {
//
// update our internal state after this socket error and throw
//
SocketException socketException = new SocketException();
UpdateStatusAfterSocketError(socketException);
if(s_LoggingEnabled)Logging.Exception(Logging.Sockets, this, "setIPv6MulticastOption", socketException);
throw socketException;
}
}