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


C# NetMQSocket类代码示例

本文整理汇总了C#中NetMQSocket的典型用法代码示例。如果您正苦于以下问题:C# NetMQSocket类的具体用法?C# NetMQSocket怎么用?C# NetMQSocket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: RemoveSocket

        public void RemoveSocket(NetMQSocket socket)
        {
            socket.EventsChanged -= OnSocketEventsChanged;

            m_sockets.Remove(socket);
            m_isDirty = true;
        }
开发者ID:bubbafat,项目名称:netmq,代码行数:7,代码来源:Poller.cs

示例2: Socket

 internal Socket(NetMQSocket socket, SocketConfiguration config)
 {
     socket.Options.Linger = config.Linger;
     socket.Options.ReceiveHighWatermark = config.ReceivingHighWatermark;
     socket.Options.SendHighWatermark = config.SendingHighWatermark;
     this.socket = socket;
 }
开发者ID:gitter-badger,项目名称:kino,代码行数:7,代码来源:Socket.cs

示例3: Transport

 public Transport(NetMQSocket value) : this()
 {
     if (value != null)
     {
         this.socket = value;
     }
 }
开发者ID:georgesimms,项目名称:logit-dotnet,代码行数:7,代码来源:Transport.cs

示例4: DeviceBase

        /// <summary>
        /// Create a new instance of the <see cref="DeviceBase"/> class.
        /// </summary>
        /// <param name="poller">the <see cref="INetMQPoller"/> to use for detecting when messages are available</param>
        /// <param name="frontendSocket">
        /// A <see cref="NetMQSocket"/> that will pass incoming messages to <paramref name="backendSocket"/>.
        /// </param>
        /// <param name="backendSocket">
        /// A <see cref="NetMQSocket"/> that will receive messages from (and optionally send replies to) <paramref name="frontendSocket"/>.
        /// </param>
        /// <param name="mode">the <see cref="DeviceMode"/> (either Blocking or Threaded) for this device</param>
        /// <exception cref="ArgumentNullException">frontendSocket must not be null.</exception>
        /// <exception cref="ArgumentNullException">backendSocket must not be null.</exception>
        protected DeviceBase(INetMQPoller poller,  NetMQSocket frontendSocket,  NetMQSocket backendSocket, DeviceMode mode)
        {
            m_isInitialized = false;

            if (frontendSocket == null)
                throw new ArgumentNullException("frontendSocket");

            if (backendSocket == null)
                throw new ArgumentNullException("backendSocket");

            FrontendSocket = frontendSocket;
            BackendSocket = backendSocket;

            FrontendSetup = new DeviceSocketSetup(FrontendSocket);
            BackendSetup = new DeviceSocketSetup(BackendSocket);

            m_poller = poller;

            FrontendSocket.ReceiveReady += FrontendHandler;
            BackendSocket.ReceiveReady += BackendHandler;

            m_poller.Add(FrontendSocket);
            m_poller.Add(BackendSocket);

            m_runner = mode == DeviceMode.Blocking
                ? new DeviceRunner(this)
                : new ThreadedDeviceRunner(this);
        }
开发者ID:awb99,项目名称:netmq,代码行数:41,代码来源:DeviceBase.cs

示例5: ConnectOrBindAddress

        public void ConnectOrBindAddress(NetMQSocket socket)
        {
            var port = socket.BindRandomPort(Uri.AbsoluteUri.TrimEnd('/'));
            var address = $"{Uri.Scheme}://{Uri.Host}:{port}";

            Uri = new Uri(address);
        }
开发者ID:simonbaas,项目名称:EasyZMq,代码行数:7,代码来源:BindRandomPortAddressBinder.cs

示例6: WebSocketClient

        internal WebSocketClient(NetMQSocket streamSocket, byte[] identity)
        {
            m_state = WebSocketClientState.Closed;
            m_streamSocket = streamSocket;
            m_outgoingMessage = null;

            Identity = identity;
        }
开发者ID:lufka,项目名称:NetMQ.WebSockets,代码行数:8,代码来源:WebSocketClient.cs

示例7: Proxy

 /// <summary>
 /// Create a new instance of a Proxy (NetMQ.Proxy)
 /// with the given sockets to serve as a front-end, a back-end, and a control socket.
 /// </summary>
 /// <param name="frontend">the socket that messages will be forwarded from</param>
 /// <param name="backend">the socket that messages will be forwarded to</param>
 /// <param name="control">this socket will have messages also sent to it - you can set this to null if not needed</param>
 /// <param name="poller">an optional external poller to use within this proxy</param>
 public Proxy([NotNull] NetMQSocket frontend, [NotNull] NetMQSocket backend, [CanBeNull] NetMQSocket control = null, Poller poller = null)
 {
     m_frontend = frontend;
     m_backend = backend;
     m_control = control;
     m_externalPoller = poller != null;
     m_poller = poller;
 }
开发者ID:bbqchickenrobot,项目名称:netmq,代码行数:16,代码来源:Proxy.cs

示例8: DoServer

 protected override void DoServer(NetMQSocket socket, int messageSize)
 {
     for (int i = 0; i < Iterations; i++)
     {
         byte[] message = socket.Receive();
         socket.Send(message);
     }
 }
开发者ID:bbqchickenrobot,项目名称:netmq,代码行数:8,代码来源:LatencyBenchmark.cs

示例9: MDPClient

 /// <summary>
 ///     setup the client with standard values
 ///     verbose == false
 ///     timeout == 2500
 ///     reties  == 3
 /// </summary>
 private MDPClient()
 {
     m_ctx = NetMQContext.Create ();
     m_client = null;
     Timeout = TimeSpan.FromMilliseconds (2500);
     Retries = 3;
     m_connected = false;
 }
开发者ID:wangkai2014,项目名称:netmq,代码行数:14,代码来源:MDPClient.cs

示例10: NmqMessageSender

 internal NmqMessageSender(Uri serviceUri)
 {
     context = NetMQContext.Create();
     socket = context.CreateRequestSocket();
     var address = string.Format("tcp://{0}:{1}", serviceUri.Host, serviceUri.Port);
     socket.Connect(address);
 }
开发者ID:yonglehou,项目名称:DistributedCommunicationDotNet,代码行数:7,代码来源:NmqMessageSender.cs

示例11: OutputWriter

 /// <summary>
 /// Initializes a new instance of the <see cref="Logit.Zmq.OutputWriter"/> class.
 /// </summary>
 /// <param name="zt">ØMQ Transport to use.</param>
 public OutputWriter(Transport zt) : base(CultureInfo.InvariantCulture)
 {
     if (zt != null)
     {
         this.socket = zt.Socket;
     }
 }
开发者ID:georgesimms,项目名称:logit-dotnet,代码行数:11,代码来源:OutputWriter.cs

示例12: SetupPublisher

        private void SetupPublisher()
        {
            Open(0);

            _publisherSocket = _context.CreatePublisherSocket();
            _publisherSocket.Bind(_configuration.PublisherAddress);
        }
开发者ID:snowattitudes,项目名称:SignalR.Backplane.NetMQ,代码行数:7,代码来源:NetMQScaleoutMessageBus.cs

示例13: FeedZmQPublisher

 public FeedZmQPublisher(string address, ILog log)
 {
     _log = log;
     _context = NetMQContext.Create();
     _socket = _context.CreatePushSocket();
     _socket.Bind(address);
 }
开发者ID:Grovesy,项目名称:Feeds,代码行数:7,代码来源:FeedZmQPublisher.cs

示例14: Start

		public async Task Start ()
		{
			ThrowIfDisposed ();
			var ct = cancellationTokenSource.Token;

			nmqPoller = new Poller ();
			nmqScheduler = new NetMQScheduler (nmqContext, nmqPoller);
			nmqServer = nmqContext.CreateResponseSocket ();
			nmqServer.Bind (Address.AbsoluteUri.TrimEnd ('/'));

			serverTask = Task.Factory.StartNew (() => {
				ct.ThrowIfCancellationRequested ();

				while (true) {
					if (ct.IsCancellationRequested) {
						// clean up here
						ct.ThrowIfCancellationRequested ();
					}
					var msg = nmqServer.Receive ();
					var request = Request.Deserialize (msg);
					var result = Handle (request);

					byte[] output_buffer = result.Serialize ();
					nmqServer.Send (output_buffer);
				}
			}, ct);

			await serverTask;
		}
开发者ID:nerdshark,项目名称:CSharpReplAddin,代码行数:29,代码来源:CSharpReplServer.cs

示例15: MDPClient

 /// <summary>
 ///     setup the client with standard values
 ///     verbose == false
 ///     timeout == 2500
 ///     reties  == 3
 /// </summary>
 private MDPClient ()
 {
     m_client = null;
     Timeout = TimeSpan.FromMilliseconds (2500);
     Retries = 3;
     m_connected = false;
 }
开发者ID:cjkao,项目名称:netmq,代码行数:13,代码来源:MDPClient.cs


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