public WindowsApi() { var fileCompletionInfo = new FILE_COMPLETION_INFORMATION { Key = IntPtr.Zero, Port = IntPtr.Zero }; this.fileCompletionInfoPtr = NativeMethods.Allocate(Marshal.SizeOf(fileCompletionInfo)); Marshal.StructureToPtr(fileCompletionInfo, this.fileCompletionInfoPtr, false); }
public async Task StartAsync( string pipeName, byte[] pipeMessage) { _pipeName = pipeName; _pipeMessage = pipeMessage; if (_fileCompletionInfoPtr == IntPtr.Zero) { var fileCompletionInfo = new FILE_COMPLETION_INFORMATION() { Key = IntPtr.Zero, Port = IntPtr.Zero }; _fileCompletionInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(fileCompletionInfo)); Marshal.StructureToPtr(fileCompletionInfo, _fileCompletionInfoPtr, false); } await StartAsync().ConfigureAwait(false); await Thread.PostAsync(listener => listener.PostCallback(), this).ConfigureAwait(false); }
public async Task StartAsync( string pipeName, ServerAddress address, KestrelThread thread) { _pipeName = pipeName; if (_fileCompletionInfoPtr == IntPtr.Zero) { var fileCompletionInfo = new FILE_COMPLETION_INFORMATION() { Key = IntPtr.Zero, Port = IntPtr.Zero }; _fileCompletionInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(fileCompletionInfo)); Marshal.StructureToPtr(fileCompletionInfo, _fileCompletionInfoPtr, false); } await StartAsync(address, thread).ConfigureAwait(false); await Thread.PostAsync(state => ((ListenerPrimary)state).PostCallback(), this).ConfigureAwait(false); }