Class Options is essentially a container for socket-related option-settings.
Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Own" /> class that is running on a thread outside of 0MQ infrastructure.
 /// </summary>
 /// <param name="parent">The parent context.</param>
 /// <param name="threadId">The thread id.</param>
 /// <remarks>
 /// Note that the owner is unspecified in the constructor. It'll be assigned later on using <see cref="SetOwner"/>
 /// when the object is plugged in.
 /// </remarks>
 protected Own([NotNull] Ctx parent, int threadId)
     : base(parent, threadId)
 {
     m_options = new Options();
 }
Exemplo n.º 2
0
Arquivo: Ctx.cs Projeto: awb99/netmq
 /// <summary>
 /// Create a new Endpoint with the given socket.
 /// </summary>
 /// <param name="socket">the socket for this new Endpoint</param>
 /// <param name="options">the Options to assign to this new Endpoint</param>
 public Endpoint( SocketBase socket,  Options options)
 {
     Socket = socket;
     Options = options;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Own" /> class that is running within I/O thread.
 /// </summary>
 /// <param name="ioThread">The I/O thread.</param>
 /// <param name="options">The options.</param>
 /// <remarks>
 /// Note that the owner is unspecified in the constructor. It'll be assigned later on using <see cref="SetOwner"/>
 /// when the object is plugged in.
 /// </remarks>
 protected Own([NotNull] IOThread ioThread, [NotNull] Options options)
     : base(ioThread)
 {
     m_options = options;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Create a new SessionBase object from the given IOThread, socket, and Address.
        /// </summary>
        /// <param name="ioThread">the IOThread for this session to run on</param>
        /// <param name="connect">this flag dictates whether to connect</param>
        /// <param name="socket">the socket to contain</param>
        /// <param name="options">Options that dictate the settings of this session</param>
        /// <param name="addr">an Address that dictates the protocol and IP-address to use when connecting</param>
        public SessionBase( IOThread ioThread, bool connect,  SocketBase socket,  Options options,  Address addr)
            : base(ioThread, options)
        {
            m_ioObject = new IOObject(ioThread);

            m_connect = connect;
            m_socket = socket;
            m_ioThread = ioThread;
            m_addr = addr;

            if (options.RawSocket)
            {
                m_identitySent = true;
                m_identityReceived = true;
            }

            m_terminatingPipes = new HashSet<Pipe>();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Create a return a new session.
 /// The specific subclass of SessionBase that is created is dictated by the SocketType specified by the options argument.
 /// </summary>
 /// <param name="ioThread">the <c>IOThread</c> for this session to run in</param>
 /// <param name="connect">whether to immediately connect</param>
 /// <param name="socket">the socket to connect</param>
 /// <param name="options">an <c>Options</c> that provides the SocketType that dictates which type of session to create</param>
 /// <param name="addr">an <c>Address</c> object that specifies the protocol and address to connect to</param>
 /// <returns>the newly-created instance of whichever subclass of SessionBase is specified by the options</returns>
 /// <exception cref="InvalidException">The socket must be of the correct type.</exception>
 
 public static SessionBase Create( IOThread ioThread, bool connect,  SocketBase socket,  Options options,  Address addr)
 {
     switch (options.SocketType)
     {
         case ZmqSocketType.Req:
             return new Req.ReqSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Dealer:
             return new Dealer.DealerSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Rep:
             return new Rep.RepSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Router:
             return new Router.RouterSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Pub:
             return new Pub.PubSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Xpub:
             return new XPub.XPubSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Sub:
             return new Sub.SubSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Xsub:
             return new XSub.XSubSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Push:
             return new Push.PushSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Pull:
             return new Pull.PullSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Pair:
             return new Pair.PairSession(ioThread, connect, socket, options, addr);
         case ZmqSocketType.Stream:
             return new Stream.StreamSession(ioThread, connect, socket, options, addr);
         default:
             throw new InvalidException("SessionBase.Create called with invalid SocketType of " + options.SocketType);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Create a new SessionBase object from the given IOThread, socket, and Address.
        /// </summary>
        /// <param name="ioThread">the IOThread for this session to run on</param>
        /// <param name="connect">this flag dictates whether to connect</param>
        /// <param name="socket">the socket to contain</param>
        /// <param name="options">Options that dictate the settings of this session</param>
        /// <param name="addr">an Address that dictates the protocol and IP-address to use when connecting</param>
        public SessionBase([NotNull] IOThread ioThread, bool connect, [NotNull] SocketBase socket, [NotNull] Options options, [NotNull] Address addr)
            : base(ioThread, options)
        {
            m_ioObject = new IOObject(ioThread);

            m_connect  = connect;
            m_socket   = socket;
            m_ioThread = ioThread;
            m_addr     = addr;

            if (options.RawSocket)
            {
                m_identitySent     = true;
                m_identityReceived = true;
            }

            m_terminatingPipes = new HashSet <Pipe>();
        }
Exemplo n.º 7
0
        public static SessionBase Create([NotNull] IOThread ioThread, bool connect, [NotNull] SocketBase socket, [NotNull] Options options, [NotNull] Address addr)
        {
            switch (options.SocketType)
            {
            case ZmqSocketType.Req:
                return(new Req.ReqSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Dealer:
                return(new Dealer.DealerSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Rep:
                return(new Rep.RepSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Router:
                return(new Router.RouterSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Pub:
                return(new Pub.PubSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Xpub:
                return(new XPub.XPubSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Sub:
                return(new Sub.SubSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Xsub:
                return(new XSub.XSubSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Push:
                return(new Push.PushSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Pull:
                return(new Pull.PullSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Pair:
                return(new Pair.PairSession(ioThread, connect, socket, options, addr));

            case ZmqSocketType.Stream:
                return(new Stream.StreamSession(ioThread, connect, socket, options, addr));

            default:
                throw new InvalidException("SessionBase.Create called with invalid SocketType of " + options.SocketType);
            }
        }
Exemplo n.º 8
0
Arquivo: Own.cs Projeto: awb99/netmq
 /// <summary>
 /// Initializes a new instance of the <see cref="Own" /> class that is running within I/O thread.
 /// </summary>
 /// <param name="ioThread">The I/O thread.</param>
 /// <param name="options">The options.</param>
 /// <remarks>
 /// Note that the owner is unspecified in the constructor. It'll be assigned later on using <see cref="SetOwner"/>
 /// when the object is plugged in.
 /// </remarks>
 protected Own( IOThread ioThread,  Options options)
     : base(ioThread)
 {
     m_options = options;
 }