示例#1
0
        internal bool DisconnectEx(SafeCloseSocket socketHandle, SafeHandle overlapped, int flags, int reserved)
        {
            EnsureDynamicWinsockMethods();
            DisconnectExDelegate disconnectEx = _dynamicWinsockMethods.GetDelegate <DisconnectExDelegate>(socketHandle);

            return(disconnectEx(socketHandle, overlapped, flags, reserved));
        }
示例#2
0
 private void EnsureDisconnectEx(SafeCloseSocket socketHandle)
 {
     if (this.disconnectEx == null)
     {
         lock (this.lockObject)
         {
             if (this.disconnectEx == null)
             {
                 Guid   guid = new Guid("{0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}");
                 IntPtr ptr  = this.LoadDynamicFunctionPointer(socketHandle, ref guid);
                 this.disconnectEx          = (DisconnectExDelegate)Marshal.GetDelegateForFunctionPointer(ptr, typeof(DisconnectExDelegate));
                 this.disconnectEx_Blocking = (DisconnectExDelegate_Blocking)Marshal.GetDelegateForFunctionPointer(ptr, typeof(DisconnectExDelegate_Blocking));
             }
         }
     }
 }
示例#3
0
 private void EnsureDisconnectEx(SafeCloseSocket socketHandle)
 {
     if (_disconnectEx == null)
     {
         lock (_lockObject)
         {
             if (_disconnectEx == null)
             {
                 Guid   guid            = new Guid("{0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}");
                 IntPtr ptrDisconnectEx = LoadDynamicFunctionPointer(socketHandle, ref guid);
                 _disconnectEx         = Marshal.GetDelegateForFunctionPointer <DisconnectExDelegate>(ptrDisconnectEx);
                 _disconnectExBlocking = Marshal.GetDelegateForFunctionPointer <DisconnectExDelegateBlocking>(ptrDisconnectEx);
             }
         }
     }
 }
示例#4
0
文件: socket.cs 项目: svermeulen/iris
        private void LoadDisconnectEx()
        {
            SocketError errorCode;
            IntPtr ptrDisconnectEx = IntPtr.Zero;

            unsafe
            {
                int length;
                Guid guid = new Guid("{0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}");

                // This can throw ObjectDisposedException.
                errorCode = UnsafeNclNativeMethods.OSSOCK.WSAIoctl(
                    m_Handle,
                    IoctlSocketConstants.SIOGETEXTENSIONFUNCTIONPOINTER,
                    ref guid,
                    sizeof(Guid),
                    out ptrDisconnectEx,
                    sizeof(IntPtr),
                    out length,
                    IntPtr.Zero,
                    IntPtr.Zero);
            }

            if (errorCode != SocketError.Success)
            {
                throw new SocketException();
            }
            s_DisconnectEx = (DisconnectExDelegate) Marshal.GetDelegateForFunctionPointer(ptrDisconnectEx, typeof(DisconnectExDelegate));
            s_DisconnectEx_Blocking = (DisconnectExDelegate_Blocking)Marshal.GetDelegateForFunctionPointer(ptrDisconnectEx, typeof(DisconnectExDelegate_Blocking));
        }