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

BindRandomPort() public method

Bind the specified TCP address to an available port, assigned by the operating system.
uses a protocol other than TCP. The socket has been stopped. The specified address is already in use. No IO thread was found, or the protocol's listener errored during /// initialisation. the socket bind failed
public BindRandomPort ( [ addr ) : int
addr [ a string denoting the endpoint to bind to
return int
        public int BindRandomPort([NotNull] string addr)
        {
            string address, protocol;

            DecodeAddress(addr, out address, out protocol);

            if (protocol != Address.TcpProtocol)
                throw new ProtocolNotSupportedException("Address must use the TCP protocol.");

            Bind(addr + ":0");
            return m_port;
        }