public void Dispose() { if (_handle != null) { _handle.Close(); _handle = null; } }
public MailslotServer(string name) { _handle = Mailslot.CreateMailslot(@"\\.\mailslot\" + name, 0, 0, IntPtr.Zero); if (_handle.IsInvalid) { throw new Win32Exception(); } }
private void CreateHandle() { _handle = Mailslot.CreateFile( @"\\" + _machine + @"\mailslot\" + _name, Mailslot.FileDesiredAccess.GenericWrite, Mailslot.FileShareMode.FileShareRead, IntPtr.Zero, Mailslot.FileCreationDisposition.OpenExisting, 0, IntPtr.Zero); if (_handle.IsInvalid) { throw new Win32Exception(); } }