Ejemplo n.º 1
0
 /// <summary>
 /// Create a new NetMQSocket with the given <see cref="SocketBase"/>.
 /// </summary>
 /// <param name="socketHandle">a SocketBase object to assign to the new socket</param>
 internal NetMQSocket([NotNull] SocketBase socketHandle)
 {
     m_selector        = new Selector();
     m_socketHandle    = socketHandle;
     Options           = new SocketOptions(this);
     m_socketEventArgs = new NetMQSocketEventArgs(this);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new NetMQSocket with the given <see cref="SocketBase"/>.
 /// </summary>
 /// <param name="socketHandle">a SocketBase object to assign to the new socket</param>
 internal NetMQSocket(SocketBase socketHandle)
 {
     m_netMqSelector   = new NetMQSelector();
     m_socketHandle    = socketHandle;
     Options           = new SocketOptions(this);
     m_socketEventArgs = new NetMQSocketEventArgs(this);
 }
Ejemplo n.º 3
0
        protected NetMQSocket(SocketBase socketHandle)
        {
            m_socketHandle    = socketHandle;
            Options           = new SocketOptions(this);
            m_socketEventArgs = new NetMQSocketEventArgs(this);

            IgnoreErrors = false;
            Errors       = 0;
        }
Ejemplo n.º 4
0
        internal NetMQSocket(ZmqSocketType socketType, string?connectionString, DefaultAction defaultAction)
        {
            m_socketHandle    = NetMQConfig.Context.CreateSocket(socketType);
            m_netMqSelector   = new NetMQSelector();
            Options           = new SocketOptions(this);
            m_socketEventArgs = new NetMQSocketEventArgs(this);

            Options.Linger = NetMQConfig.Linger;

            if (!Strings.IsNullOrEmpty(connectionString))
            {
                var endpoints = connectionString
                                .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                .Select(a => a.Trim())
                                .Where(a => !string.IsNullOrEmpty(a));

                foreach (var endpoint in endpoints)
                {
                    switch (endpoint[0])
                    {
                    case '@':
                        Bind(endpoint.Substring(1));
                        break;

                    case '>':
                        Connect(endpoint.Substring(1));
                        break;

                    default:
                        if (defaultAction == DefaultAction.Connect)
                        {
                            Connect(endpoint);
                        }
                        else
                        {
                            Bind(endpoint);
                        }
                        break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Create a new NetMQSocket with the given <see cref="ZmqSocketType"/>.
        /// </summary>
        /// <param name="socketType">Type of socket to create</param>
        internal NetMQSocket(ZmqSocketType socketType, string connectionString, DefaultAction defaultAction)
        {
            m_socketHandle    = NetMQConfig.Context.CreateSocket(socketType);
            m_selector        = new Selector();
            Options           = new SocketOptions(this);
            m_socketEventArgs = new NetMQSocketEventArgs(this);

            Options.Linger = NetMQConfig.Linger;

            if (!string.IsNullOrEmpty(connectionString))
            {
                var endpoints =
                    connectionString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(a => a.Trim()).Where(a => !string.IsNullOrEmpty(a));

                foreach (string endpoint in endpoints)
                {
                    if (endpoint[0] == '@')
                    {
                        Bind(endpoint.Substring(1));
                    }
                    else if (endpoint[0] == '>')
                    {
                        Connect(endpoint.Substring(1));
                    }
                    else if (defaultAction == DefaultAction.Connect)
                    {
                        Connect(endpoint);
                    }
                    else
                    {
                        Bind(endpoint);
                    }
                }
            }
        }