当前位置: 首页>>代码示例>>C#>>正文


C# ZmqSocket.Bind方法代码示例

本文整理汇总了C#中ZmqSocket.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# ZmqSocket.Bind方法的具体用法?C# ZmqSocket.Bind怎么用?C# ZmqSocket.Bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZmqSocket的用法示例。


在下文中一共展示了ZmqSocket.Bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitialiseSocket

 public void InitialiseSocket()
 {
     m_PublishSocket = m_Context.CreateSocket(SocketType.PUB);
     m_PublishSocket.Bind("epgm://239.1.1.1:9500");
     m_PublishSocket.Bind("tcp://*:9500");
     m_PublishSocket.Bind("inproc://Local");
 }
开发者ID:jystic,项目名称:Triangles-in-space,代码行数:7,代码来源:MessageSender.cs

示例2: Open

        private static void Open(Object cancelationToken)
        {
            context = ZmqContext.Create();

            frontend = context.CreateSocket(SocketType.ROUTER);
            backend = context.CreateSocket(SocketType.DEALER);
            backend.Identity = Encoding.UTF8.GetBytes("inproc://workers");
            frontend.Bind("tcp://127.0.0.1:5000");

            backend.Bind("inproc://workers");

            workerThreads = new Thread[2];
            for (int threadId = 0; threadId < workerThreads.Length; threadId++)
            {
                workerThreads[threadId] = new Thread(WorkerRoutine);
                workerThreads[threadId].Start(context);
            }

            frontend.ReceiveReady += new EventHandler<SocketEventArgs>(frontend_ReceiveReady);
            backend.ReceiveReady += new EventHandler<SocketEventArgs>(backend_ReceiveReady);

            Poller poller = new Poller(new[] { frontend, backend });
            var token = (CancellationToken)cancelationToken;
            while (!token.IsCancellationRequested)
            {
                poller.Poll(TimeSpan.FromMilliseconds(100));
            }
        }
开发者ID:maslakov,项目名称:zmqtests,代码行数:28,代码来源:Program.cs

示例3: ZmqPublisher

 public ZmqPublisher(string endpoint)
 {
     _endpoint = endpoint;
     _context = ZmqContext.Create();
     _socket = _context.CreateSocket(SocketType.PUB);
     _socket.Bind(_endpoint);
 }
开发者ID:modulexcite,项目名称:graveyard,代码行数:7,代码来源:ZmqPublisher.cs

示例4: CreateCommandReceiverSocket

 public void CreateCommandReceiverSocket(string endpoint)
 {
     _receptionSocket = _context.CreateSocket(SocketType.PULL);
     _receptionSocket.Linger = TimeSpan.FromSeconds(1);
     _receptionSocket.ReceiveHighWatermark = 30000;
     _receptionSocket.Bind(endpoint);
     _logger.DebugFormat("Command processor socket bound to {0}", endpoint);
 }
开发者ID:jbouzaglou,项目名称:PetPigeonsESB,代码行数:8,代码来源:ZmqPullWireDataReceiver.cs

示例5: ZeroMqMessagePublisher

		public ZeroMqMessagePublisher(ZmqContext context)
		{
			Console.WriteLine("Hey there");
			_pub = context.CreateSocket(SocketType.PUB);
			_pub.Bind("tcp://*:5555");

			Console.WriteLine("Hello");
		}
开发者ID:kijanawoodard,项目名称:NServiceBus.ZeroMQ,代码行数:8,代码来源:ZeroMqMessagePublisher.cs

示例6: CreateReceiveSocket

        public void CreateReceiveSocket()
        {
            m_SubscribeSocket = m_Context.CreateSocket(SocketType.SUB);

            m_SubscribeSocket.SubscribeAll();
            m_SubscribeSocket.Connect("epgm://239.1.1.1:9500");
            m_SubscribeSocket.Bind("tcp://*:9501");
            m_SubscribeSocket.Connect("inproc://Local");
        }
开发者ID:jystic,项目名称:Triangles-in-space,代码行数:9,代码来源:MessageReceiver.cs

示例7: Bind

        public override void Bind(ZmqSocket socket, ZeroRoute config)
        {
            ZeroLog.LogInfo("pull bind....");

            foreach (var endPoint in config.ConnectEndPoints())
            {
                socket.Bind(endPoint);

                ZeroLog.LogInfo("pull bind....");
            }
        }
开发者ID:dzhendong,项目名称:Zero,代码行数:11,代码来源:PullService.cs

示例8: Start

        public void Start()
        {
            _context = ZmqContext.Create();
            _commandReceiver = _context.CreateSocket(SocketType.REP);
            _commandReceiver.Bind("tcp://*:7777");

            _dequeueReceiver = _context.CreateSocket(SocketType.PUB);
            _dequeueReceiver.Bind("tcp://*:7778");

            StartListener();
        }
开发者ID:welly87,项目名称:moneytrain,代码行数:11,代码来源:FlazzQueue.cs

示例9: Start

        public void Start()
        {
            if (!string.IsNullOrWhiteSpace(_PubEndPoint))
            {
                ZmqEventPublisher = ZeroMessageQueue.ZmqContext.CreateSocket(SocketType.PUB);
                ZmqEventPublisher.Bind(_PubEndPoint);

                using (var messageStore = IoCFactory.Resolve<IMessageStore>())
                {
                    messageStore.GetAllUnPublishedEvents()
                        .ForEach(eventContext => MessageQueue.Add(eventContext));
                }
                _WorkTask = Task.Factory.StartNew(PublishEvent, TaskCreationOptions.LongRunning);
            }
        }
开发者ID:vebin,项目名称:IFramework,代码行数:15,代码来源:EventPublisher.cs

示例10: Bind

        public ZmqEndPoint Bind()
        {
            _socket = CreateSocket();

            _endPoint = new ZmqEndPoint(_originalEndpoint.Value); 
            if (_endPoint.HasRandomPort)
                _endPoint.SelectRandomPort(_peerId, _environment);

            _socket.Bind(_endPoint.Value);

            var endPointWithIp = new ZmqEndPoint(_socket.LastEndpoint);
            _logger.InfoFormat("Socket bound, Inbound EndPoint: {0}", endPointWithIp.Value);

            return endPointWithIp;
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:15,代码来源:ZmqInboundSocket.cs

示例11: Main

        static void Main(string[] args)
        {
            context_ = ZmqContext.Create();
            socket_ = context_.CreateSocket(SocketType.PUB);
            socket_.Bind("tcp://127.0.0.1:5000");

            bool publish = true;
            Task.Run(() => {
                while (publish)
                {
                    string timestring = DateTime.Now.ToString("u");
                    Console.WriteLine("Sending '{0}' to subscribers", timestring);
                    socket_.Send(timestring, Encoding.Unicode);
                    Thread.Sleep(1000);
                }
            });
            Console.ReadLine();
            publish = false;
        }
开发者ID:virtualizedfrog,项目名称:blog_code,代码行数:19,代码来源:Program.cs

示例12: Publisher

        public Publisher(string _guid, string _host, int _port, ZmqContext _ctx)
        {
            guid = _guid;
            host = _host;
            port = _port;

            if (_ctx == null)
                ctx = ZmqContext.Create();
            else
                ctx = _ctx;
            socket = ctx.CreateSocket(SocketType.PUB);
            var bindString = String.Empty;
            if(port > 0)
                bindString = String.Format("tcp://*:{0}", port);
            else
                bindString = String.Format("inproc://{0}", guid.ToLower());
            socket.Bind(bindString);
            log.InfoFormat("Publisher successfuly binded on {0}", bindString);
            socket.SendHighWatermark = 1000000;
            socket.SendBufferSize = 128 * 1024;
        }
开发者ID:h0x91b,项目名称:ESB-csharp-server,代码行数:21,代码来源:Publisher.cs

示例13: ServerThread

        void ServerThread()
        {
            using (context ?? (context = ZmqContext.Create()))
            using (subscribeSocket = context.CreateSocket(SocketType.XSUB))
            using (publishSocket = context.CreateSocket(SocketType.XPUB))
            {
                publishSocket.Bind(PublishAddress);
                subscribeSocket.Bind(SubscribeAddress);

                publishSocket.ReceiveReady += publishSocket_ReceiveReady;
                subscribeSocket.ReceiveReady += subscribeSocket_ReceiveReady;

                var poller = new Poller(new List<ZmqSocket> { subscribeSocket, publishSocket });

                InitializationDone.Set();

                while (true)
                {
                    poller.Poll();
                }
            }
        }
开发者ID:techtronics,项目名称:succubus,代码行数:22,代码来源:MessageHost.cs

示例14: Start

        public void Start(ZmqContext context)
        {
            this.SetUpMonitorChannel(context);
            this.SetUpAddSubscriberCountChannel(context);

            ////this should work but the forwarder device appears to be broken - it does not use XSUb and XPUB sockets
            ////ForwarderDevice = new ForwarderDevice(context, PublishAddressServer, SubscribeAddressServer, DeviceMode.Threaded);
            ////ForwarderDevice.Start();
            ////while (!ForwarderDevice.IsRunning)
            ////{ }

            QueueDevce = new QueueDevice(context, PubSubControlBackAddressServer, PubSubControlFrontAddress, DeviceMode.Threaded);
            QueueDevce.Start();
            while (!QueueDevce.IsRunning)
            {
            }

            this.Writeline("Control channel started");

            //this.Context = context;
            this.cancellationTokenSource = new CancellationTokenSource();
            var token = this.cancellationTokenSource.Token;
            Task.Run(() =>
            {
                using (frontend = context.CreateSocket(SocketType.XSUB))
                {
                    using (backend = context.CreateSocket(SocketType.XPUB))
                    {
                        frontend.Bind(Pipe.PublishAddressServer); ////"tcp://*:5550");
                        backend.Bind(Pipe.SubscribeAddressServer); ////"tcp://*:5553");
                        frontend.ReceiveReady += new EventHandler<SocketEventArgs>(FrontendReceiveReady);
                        backend.ReceiveReady += new EventHandler<SocketEventArgs>(BackendReceiveReady);
                        this.AddSubscriberCountChannel.ReceiveReady += new EventHandler<SocketEventArgs>(AddSubscriberCountChannelReceiveReady);
                        using (poller = new Poller(new ZmqSocket[] { frontend, backend, this.AddSubscriberCountChannel }))
                        {
                            Writeline("About to start polling");

                            while (true)
                            {
                                poller.Poll(new TimeSpan(0,0,0,0,5));
                                Writeline("polling");
                                if (token.IsCancellationRequested)
                                {
                                    Writeline("break");
                                    break;
                                }
                            }
                        }

                        Writeline("stopped polling and exiting");
                    }
                }
            },
            token);
        }
开发者ID:nka1,项目名称:Daytona,代码行数:55,代码来源:Pipe.cs

示例15: StartServer

        /// <summary>
        /// Start the server.
        /// </summary>
        public void StartServer()
        {
            //check that it's not already running
            if (ServerRunning) return;
            _context = ZmqContext.Create();
            _routerSocket = _context.CreateSocket(SocketType.ROUTER);
            _routerSocket.Bind("tcp://*:" + _listenPort);

            _runServer = true;
            _serverThread.Start();
            ServerRunning = true;
        }
开发者ID:KeithNel,项目名称:qdms,代码行数:15,代码来源:HistoricalDataServer.cs


注:本文中的ZmqSocket.Bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。