Beispiel #1
0
 public void CreateSocketTest()
 {
     Context ctx = new Context();
     Socket socket = ctx.CreateSocket( SocketType.Publisher );
     Assert.IsNotNull( socket );
 }
Beispiel #2
0
 public void ContextConstructorTest1()
 {
     Context ctx = new Context();
     Assert.IsNotNull( ctx );
     Assert.IsFalse( ctx.Disposed );
 }
Beispiel #3
0
        /// <summary>
        /// Creates a new stream of the specified type for the specified context.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="socketType"></param>
        /// <param name="lingerTime">Linger period for socket shutdown, in ms, or <see cref="Timeout.Infinite"/> for no linger.</param>
        protected ZMQStream( Context context, SocketType socketType, int lingerTime = Context.DEFAULT_LINGER )
            : base()
        {
            Contract.Requires( context != null );
            Contract.Requires( lingerTime >= 0 || lingerTime == Timeout.Infinite );

            Disposed = false;

            m_context = context;
            m_socket = m_context.CreateSocket( socketType );

            if( lingerTime >= 0 )
            {
                m_socket.SetOption( SocketOption.Linger, lingerTime );
            }
        }
Beispiel #4
0
        public void DisposeTest()
        {
            Context ctx = new Context();
            ctx.Dispose();
            Assert.IsTrue( ctx.Disposed );

            try
            {
                ctx.CreateSocket( SocketType.Publisher );
                Assert.Fail( "Disposed Context should not be able to create sockets." );
            }
            catch
            {
            }
        }
Beispiel #5
0
 static ZMQStream()
 {
     defaultContext = new Context();
 }