コード例 #1
0
        internal bool DisconnectExBlocking(SafeCloseSocket socketHandle, IntPtr overlapped, int flags, int reserved)
        {
            EnsureDynamicWinsockMethods();
            DisconnectExDelegateBlocking disconnectEx_Blocking = _dynamicWinsockMethods.GetDelegate <DisconnectExDelegateBlocking>(socketHandle);

            return(disconnectEx_Blocking(socketHandle, overlapped, flags, reserved));
        }
コード例 #2
0
 private void EnsureDisconnectEx(SafeSocketHandle 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);
                 _disconnectExBlocking = Marshal.GetDelegateForFunctionPointer <DisconnectExDelegateBlocking>(ptrDisconnectEx);
                 Volatile.Write(ref _disconnectEx, Marshal.GetDelegateForFunctionPointer <DisconnectExDelegate>(ptrDisconnectEx));
             }
         }
     }
 }