示例#1
0
        public void BindRandomThenUnbind()
        {
            using (var pub = new PublisherSocket())
            {
                var port = pub.BindRandomPort("tcp://localhost");

                pub.Unbind("tcp://localhost:" + port);
            }

            using (var pub = new PublisherSocket())
            {
                var port = pub.BindRandomPort("tcp://*");

                pub.Unbind("tcp://*:" + port);
            }

            using (var pub = new PublisherSocket())
            {
                var port1 = pub.BindRandomPort("tcp://*");
                var port2 = pub.BindRandomPort("tcp://*");
                var port3 = pub.BindRandomPort("tcp://*");

                pub.Unbind("tcp://*:" + port1);
                pub.Unbind("tcp://*:" + port2);
                pub.Unbind("tcp://*:" + port3);
            }
        }
示例#2
0
 private void OnDestroy()
 {
     Debug.Log("ZMQ Destroy: Teardown socket");
     if (_pubSocket != null)
     {
         try
         {
             _pubSocket.Unbind("tcp://127.0.0.1:12345");
             _pubSocket.Dispose();
         } catch (ObjectDisposedException e)
         {
             Debug.LogWarning("PubSocket already disposed");
         }
     }
 }
示例#3
0
        /// <summary>
        /// Remote <see cref="IAddress"/> from the socket
        /// </summary>
        /// <param name="address"><see cref="IAddress"/> to be removed</param>
        public override void SocketRemove(IAddress address)
        {
            if (disposedValue)
            {
                throw new InvalidOperationException("NetMQPublisher has been disposed");
            }

            socket.Unbind(address.ToString());
        }
 /// <summary>
 /// Stops MQ Publisher once and for all
 /// </summary>
 public void Stop()
 {
     if (Publisher != null)
     {
         Publisher.Unbind("tcp://" + IP + ":" + Port.ToString());
         Publisher.Close();
         Publisher.Dispose();
         Publisher = null;
     }
 }
示例#5
0
 public void Quit()
 {
     isBinded = false;
     if (pubSocket != null)
     {
         pubSocket.Unbind(BindAddres);
         pubSocket.Close();
         pubSocket = null;
     }
 }
 protected override void OnStop(PublisherSocket socket)
 {
     socket.Unbind(_bindingAddress);
 }