示例#1
0
        public SessionBase(IOThread ioThread, bool connect,
                                             SocketBase socket, Options options, Address addr)
            : base(ioThread, options)
        {
            m_ioObject = new IOObject(ioThread);

            m_connect = connect;
            m_pipe = null;
            m_incompleteIn = false;
            m_pending = false;
            m_engine = null;
            m_socket = socket;
            m_ioThread = ioThread;
            m_hasLingerTimer = false;
            m_identitySent = false;
            m_identityReceived = false;
            m_addr = addr;

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

            m_terminatingPipes = new HashSet<Pipe>();
        }
示例#2
0
 public PgmSession(PgmSocket pgmSocket, Options options)
 {
     m_handle = pgmSocket.FD;
     m_pgmSocket = pgmSocket;
     m_options = options;
     data = new byte[Config.PgmMaxTPDU];
 }
示例#3
0
        public PgmListener(IOThread ioThread, SocketBase socket, Options options)
            : base(ioThread, options)
        {
            m_socket = socket;

            m_ioObject = new IOObject(ioThread);
        }
示例#4
0
 public TcpListener(IOThread ioThread, SocketBase socket, Options options)
     : base(ioThread, options)
 {
     m_ioObject = new IOObject(ioThread);
     m_address = new TcpAddress();
     m_handle = null;
     m_socket = socket;
 }
示例#5
0
文件: Own.cs 项目: JayShelton/netmq
        /// <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(Ctx parent, int threadId)
            : base(parent, threadId)
        {
            m_terminating = false;
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            m_options = new Options();
        }
示例#6
0
 public PgmSender(IOThread ioThread, Options options, Address addr)
     : base(ioThread)
 {
     m_options = options;
     m_addr = addr;
     m_encoder = null;
     m_outBuffer = null;
     m_outBufferSize = 0;
     m_writeSize = 0;
     m_encoder = new Encoder(0, m_options.Endian);
 }
示例#7
0
文件: Own.cs 项目: bubbafat/netmq
        //  The object is living within I/O thread.
        public Own(IOThread ioThread, Options options)
            : base(ioThread)
        {
            m_options = options;
            m_terminating = false;
            m_sentSeqnum = new AtomicLong(0);
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            owned = new HashSet<Own>();
        }
示例#8
0
文件: Own.cs 项目: bubbafat/netmq
        //  Note that the owner is unspecified in the constructor.
        //  It'll be supplied later on when the object is plugged in.
        //  The object is not living within an I/O thread. It has it's own
        //  thread outside of 0MQ infrastructure.
        public Own(Ctx parent, int tid)
            : base(parent, tid)
        {
            m_terminating = false;
            m_sentSeqnum = new AtomicLong(0);
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            m_options = new Options();
            owned = new HashSet<Own>();
        }
示例#9
0
        public TcpConnecter(IOThread ioThread,
												SessionBase session, Options options,
												Address addr, bool delayedStart)
            : base(ioThread, options)
        {
            m_ioObject = new IOObject(ioThread);
            m_addr = addr;
            m_handle = null;
            m_handleValid = false;
            m_delayedStart = delayedStart;
            m_timerStarted = false;
            m_session = session;
            m_currentReconnectIvl = m_options.ReconnectIvl;

            Debug.Assert(m_addr != null);
            m_endpoint = m_addr.ToString();
            m_socket = session.Socket;
        }
示例#10
0
            public ReqSession(IOThread ioThread, bool connect,
												SocketBase socket, Options options,
												Address addr)
                : base(ioThread, connect, socket, options, addr)
            {
                m_state = State.Identity;
            }
示例#11
0
        public StreamEngine(Socket fd, Options options, String endpoint)
        {
            m_handle = fd;
            //      inbuf = null;
            m_insize = 0;
            m_inputError = false;
            //        outbuf = null;
            m_outsize = 0;
            m_handshaking = true;
            m_session = null;
            m_options = options;
            m_plugged = false;
            m_endpoint = endpoint;
            m_socket = null;
            m_encoder = null;
            m_decoder = null;

            //  Put the socket into non-blocking mode.
            Utils.UnblockSocket(m_handle);

            //  Set the socket buffer limits for the underlying socket.
            if (m_options.SendBuffer != 0)
            {
                m_handle.SendBufferSize = m_options.SendBuffer;
            }
            if (m_options.ReceiveBuffer != 0)
            {
                m_handle.ReceiveBufferSize = m_options.ReceiveBuffer;
            }
        }
示例#12
0
 public RouterSession(IOThread ioThread, bool connect,
                      SocketBase socket, Options options,
                      Address addr)
     : base(ioThread, connect, socket, options, addr)
 {
 }
示例#13
0
 public IpcListener(IOThread ioThread, SocketBase socket, Options options)
     : base(ioThread, socket, options)
 {
     m_address = new IpcAddress();
 }
示例#14
0
 public Endpoint(SocketBase socket, Options options)
 {
     Socket = socket;
     Options = options;
 }
示例#15
0
        public static SessionBase Create(IOThread ioThread, bool connect,
                                                                         SocketBase socket, Options options, Address addr)
        {
            SessionBase s;
            switch (options.SocketType)
            {
                case ZmqSocketType.Req:
                    s = new Req.ReqSession(ioThread, connect,
                                                                     socket, options, addr);
                    break;
                case ZmqSocketType.Dealer:
                    s = new Dealer.DealerSession(ioThread, connect,
                                                                                socket, options, addr);
                    break;
                case ZmqSocketType.Rep:
                    s = new Rep.RepSession(ioThread, connect,
                                                                    socket, options, addr);
                    break;
                case ZmqSocketType.Router:
                    s = new Router.RouterSession(ioThread, connect,
                                                                                socket, options, addr);
                    break;
                case ZmqSocketType.Pub:
                    s = new Pub.PubSession(ioThread, connect,
                                                                    socket, options, addr);
                    break;
                case ZmqSocketType.Xpub:
                    s = new XPub.XPubSession(ioThread, connect,
                                                                     socket, options, addr);
                    break;
                case ZmqSocketType.Sub:
                    s = new Sub.SubSession(ioThread, connect,
                                                                     socket, options, addr);
                    break;
                case ZmqSocketType.Xsub:
                    s = new XSub.XSubSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;

                case ZmqSocketType.Push:
                    s = new Push.PushSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;
                case ZmqSocketType.Pull:
                    s = new Pull.PullSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;
                case ZmqSocketType.Pair:
                    s = new Pair.PairSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;
                case ZmqSocketType.Stream:
                    s = new Stream.StreamSession(ioThread, connect, socket, options, addr);
                    break;
                default:
                    throw InvalidException.Create("type=" + options.SocketType);

            }
            return s;
        }
示例#16
0
 public PgmSocket(Options options, PgmSocketType pgmSocketType, PgmAddress pgmAddress)
 {
     m_options = options;
     m_pgmSocketType = pgmSocketType;
     m_pgmAddress = pgmAddress;
 }
示例#17
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();
 }
示例#18
0
文件: Own.cs 项目: JayShelton/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;
     m_terminating = false;
     m_processedSeqnum = 0;
     m_owner = null;
     m_termAcks = 0;
 }
示例#19
0
            public PairSession(IOThread ioThread, bool connect,
			                   SocketBase socket, Options options,
			                   Address addr)
                : base(ioThread, connect, socket, options, addr)
            {
            }
示例#20
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;
 }