NetMQ.Core.SocketBase.TermEndpoint C# (CSharp) Method

TermEndpoint() public method

Disconnect from the given endpoint.
is null. Endpoint was not found and cannot be disconnected. The specified protocol must be valid. The socket has been stopped.
public TermEndpoint ( [ addr ) : void
addr [ the endpoint to disconnect from
return void
        public void TermEndpoint([NotNull] string addr)
        {
            CheckContextTerminated();

            // Check whether endpoint address passed to the function is valid.
            if (addr == null)
                throw new ArgumentNullException("addr");

            // Process pending commands, if any, since there could be pending unprocessed process_own()'s
            //  (from launch_child() for example) we're asked to terminate now.
            ProcessCommands(0, false);

            string protocol;
            string address;

            DecodeAddress(addr, out address, out protocol);

            CheckProtocol(protocol);

            if (protocol == Address.InProcProtocol)
            {
                if (UnregisterEndpoint(addr, this))
                    return;

                Pipe pipe;
                if (!m_inprocs.TryGetValue(addr, out pipe))
                    throw new EndpointNotFoundException("Endpoint was not found and cannot be disconnected");

                pipe.Terminate(true);
                m_inprocs.Remove(addr);
            }
            else
            {
                Endpoint endpoint;
                if (!m_endpoints.TryGetValue(addr, out endpoint))
                    throw new EndpointNotFoundException("Endpoint was not found and cannot be disconnected");

                if (endpoint.Pipe != null)
                    endpoint.Pipe.Terminate(false);

                TermChild(endpoint.Own);
                m_endpoints.Remove(addr);
            }
        }