public static SocketError SetIPv6MulticastOption(SafeCloseSocket handle, SocketOptionName optionName, IPv6MulticastOption optionValue) { Interop.Winsock.IPv6MulticastRequest ipmr = new Interop.Winsock.IPv6MulticastRequest(); ipmr.MulticastAddress = optionValue.Group.GetAddressBytes(); ipmr.InterfaceIndex = unchecked ((int)optionValue.InterfaceIndex); // This can throw ObjectDisposedException. SocketError errorCode = Interop.Winsock.setsockopt( handle, SocketOptionLevel.IPv6, optionName, ref ipmr, Interop.Winsock.IPv6MulticastRequest.Size); return(errorCode == SocketError.SocketError ? GetLastSocketError() : SocketError.Success); }
public static SocketError GetIPv6MulticastOption(SafeCloseSocket handle, SocketOptionName optionName, out IPv6MulticastOption optionValue) { Interop.Winsock.IPv6MulticastRequest ipmr = new Interop.Winsock.IPv6MulticastRequest(); int optlen = Interop.Winsock.IPv6MulticastRequest.Size; // This can throw ObjectDisposedException. SocketError errorCode = Interop.Winsock.getsockopt( handle, SocketOptionLevel.IP, optionName, out ipmr, ref optlen); if (errorCode == SocketError.SocketError) { optionValue = default(IPv6MulticastOption); return(GetLastSocketError()); } optionValue = new IPv6MulticastOption(new IPAddress(ipmr.MulticastAddress), ipmr.InterfaceIndex); return(SocketError.Success); }
public static SocketError GetIPv6MulticastOption(SafeCloseSocket handle, SocketOptionName optionName, out IPv6MulticastOption optionValue) { Interop.Winsock.IPv6MulticastRequest ipmr = new Interop.Winsock.IPv6MulticastRequest(); int optlen = Interop.Winsock.IPv6MulticastRequest.Size; // This can throw ObjectDisposedException. SocketError errorCode = Interop.Winsock.getsockopt( handle, SocketOptionLevel.IP, optionName, out ipmr, ref optlen); if (errorCode == SocketError.SocketError) { optionValue = default(IPv6MulticastOption); return GetLastSocketError(); } optionValue = new IPv6MulticastOption(new IPAddress(ipmr.MulticastAddress), ipmr.InterfaceIndex); return SocketError.Success; }
public static SocketError SetIPv6MulticastOption(SafeCloseSocket handle, SocketOptionName optionName, IPv6MulticastOption optionValue) { Interop.Winsock.IPv6MulticastRequest ipmr = new Interop.Winsock.IPv6MulticastRequest(); ipmr.MulticastAddress = optionValue.Group.GetAddressBytes(); ipmr.InterfaceIndex = unchecked((int)optionValue.InterfaceIndex); // This can throw ObjectDisposedException. SocketError errorCode = Interop.Winsock.setsockopt( handle, SocketOptionLevel.IPv6, optionName, ref ipmr, Interop.Winsock.IPv6MulticastRequest.Size); return errorCode == SocketError.SocketError ? GetLastSocketError() : SocketError.Success; }