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)); }
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)); } } } }