Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected override void OnStart(string[] args)
- {
- new Thread(() =>
- {
- while (true)
- {
- using (var pipe = new NamedPipeServerStream("test", PipeDirection.InOut, 1, PipeTransmissionMode.Byte))
- {
- var ps = new PipeSecurity();
- ps.AddAccessRule(new PipeAccessRule(WindowsIdentity.GetCurrent().Name, PipeAccessRights.FullControl, AccessControlType.Allow));
- pipe.SetAccessControl(ps);
- pipe.WaitForConnection();
- int x = pipe.ReadByte();
- pipe.WriteByte((byte)(x + 1));
- }
- }
- })
- { IsBackground = true }.Start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement