Ejemplo n.º 1
0
 internal void AddCallback(IpcCallback <T> callback)
 {
     lock (_dictionaryLock)
     {
         _callbacks.TryAdd(callback.Id, callback.CallbackAction);
     }
 }
Ejemplo n.º 2
0
        public IpcServer(
            String pipename,
            IpcCallback callback,
            int instances
            )
        {
            Debug.Assert(!m_running);
            m_running = true;

            // Save parameters for next new pipe
            m_pipename = pipename;
            m_callback = callback;

            // Provide full access to the current user so more pipe instances can be created
            m_ps = new PipeSecurity();
            m_ps.AddAccessRule(
                new PipeAccessRule(WindowsIdentity.GetCurrent().User, PipeAccessRights.FullControl, AccessControlType.Allow)
                );
            m_ps.AddAccessRule(
                new PipeAccessRule(
                    new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null), PipeAccessRights.ReadWrite, AccessControlType.Allow
                    )
                );

            // Start accepting connections
            for (int i = 0; i < instances; ++i)
            {
                IpcServerPipeCreate();
            }
        }
Ejemplo n.º 3
0
        public IpcServer(
            String      pipename,
            IpcCallback callback,
            int         instances
        )
        {
            Debug.Assert(!m_running);
            m_running = true;

            // Save parameters for next new pipe
            m_pipename = pipename;
            m_callback = callback;

            // Provide full access to the current user so more pipe instances can be created
            m_ps = new PipeSecurity();
            m_ps.AddAccessRule(
                new PipeAccessRule(WindowsIdentity.GetCurrent().User, PipeAccessRights.FullControl, AccessControlType.Allow)
            );
            m_ps.AddAccessRule(
                new PipeAccessRule(
                    new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null), PipeAccessRights.ReadWrite, AccessControlType.Allow
                )
            );

            // Start accepting connections
            for (int i = 0; i < instances; ++i)
                IpcServerPipeCreate();
        }