Example #1
0
 public void Dispose()
 {
     if (_handle != null)
     {
         _handle.Close();
         _handle = null;
     }
 }
Example #2
0
        public MailslotServer(string name)
        {
            _handle = Mailslot.CreateMailslot(@"\\.\mailslot\" + name, 0, unchecked ((int)0xFFFFFFFF), IntPtr.Zero);

            if (_handle.IsInvalid)
            {
                throw new Win32Exception();
            }
        }
Example #3
0
        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();
            }
        }