コード例 #1
0
 internal static extern SocketError setsockopt(
     [In] SafeCloseSocket socketHandle,
     [In] SocketOptionLevel optionLevel,
     [In] SocketOptionName optionName,
     [In] ref IPv6MulticastRequest mreq,
     [In] int optionLength
     );
コード例 #2
0
 internal static extern SocketError getsockopt(
     [In] SafeCloseSocket socketHandle,
     [In] SocketOptionLevel optionLevel,
     [In] SocketOptionName optionName,
     [Out] out IPv6MulticastRequest optionValue,
     [In, Out] ref int optionLength
     );
コード例 #3
0
ファイル: Socket.cs プロジェクト: REALTOBIZ/mono
        /// <devdoc>
        ///     <para>
        ///         IPv6 getsockopt for JOIN / LEAVE multicast group
        ///     </para>
        /// </devdoc>
        private IPv6MulticastOption getIPv6MulticastOpt(SocketOptionName optionName) {
            IPv6MulticastRequest ipmr = new IPv6MulticastRequest();

            int optlen = IPv6MulticastRequest.Size;

            // This can throw ObjectDisposedException.
            SocketError errorCode = UnsafeNclNativeMethods.OSSOCK.getsockopt(
                m_Handle,
                SocketOptionLevel.IP,
                optionName,
                out ipmr,
                ref optlen);

            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::getIPv6MulticastOpt() UnsafeNclNativeMethods.OSSOCK.getsockopt 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, "getIPv6MulticastOpt", socketException);
                throw socketException;
            }

            IPv6MulticastOption multicastOption = new IPv6MulticastOption(new IPAddress(ipmr.MulticastAddress),ipmr.InterfaceIndex);

            return multicastOption;
        }
コード例 #4
0
ファイル: Socket.cs プロジェクト: REALTOBIZ/mono
        /// <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;
            }
        }
コード例 #5
0
ファイル: Socket.cs プロジェクト: korifey/hackathon-Ideaphone
 private IPv6MulticastOption getIPv6MulticastOpt(SocketOptionName optionName)
 {
     IPv6MulticastRequest optionValue = new IPv6MulticastRequest();
       int optionLength = IPv6MulticastRequest.Size;
       if (UnsafeNclNativeMethods.OSSOCK.getsockopt(this.m_Handle, SocketOptionLevel.IP, optionName, out optionValue, out optionLength) != SocketError.SocketError)
     return new IPv6MulticastOption(new IPAddress(optionValue.MulticastAddress), (long) optionValue.InterfaceIndex);
       SocketException socketException = new SocketException();
       this.UpdateStatusAfterSocketError(socketException);
       if (Socket.s_LoggingEnabled)
     Logging.Exception(Logging.Sockets, (object) this, "getIPv6MulticastOpt", (Exception) socketException);
       throw socketException;
 }
 internal static extern SocketError getsockopt([In] SafeCloseSocket socketHandle, [In] SocketOptionLevel optionLevel, [In] SocketOptionName optionName, out IPv6MulticastRequest optionValue, [In, Out] ref int optionLength);
コード例 #7
0
 private void setIPv6MulticastOption(SocketOptionName optionName, IPv6MulticastOption MR)
 {
     IPv6MulticastRequest mreq = new IPv6MulticastRequest {
         MulticastAddress = MR.Group.GetAddressBytes(),
         InterfaceIndex = (int) MR.InterfaceIndex
     };
     if (UnsafeNclNativeMethods.OSSOCK.setsockopt(this.m_Handle, SocketOptionLevel.IPv6, optionName, ref mreq, IPv6MulticastRequest.Size) == SocketError.SocketError)
     {
         SocketException socketException = new SocketException();
         this.UpdateStatusAfterSocketError(socketException);
         if (s_LoggingEnabled)
         {
             Logging.Exception(Logging.Sockets, this, "setIPv6MulticastOption", socketException);
         }
         throw socketException;
     }
 }