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


C# NetMQSocket.Subscribe方法代码示例

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


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

示例1: MessageHelper

		public MessageHelper(string address, string topic)
		{
			_context = NetMQContext.Create();
			_subscribeSocket = _context.CreateSubscriberSocket();
			_subscribeSocket.Connect(address);
			_subscribeSocket.ReceiveReady += SubscribeSocketOnReceiveReady;
			_subscribeSocket.Subscribe(topic);
			_poller = new Poller();
			_poller.AddSocket(_subscribeSocket);
			Task.Factory.StartNew(_poller.Start);
		}
开发者ID:jacob-adams,项目名称:message-result-client,代码行数:11,代码来源:MessageHelper.cs

示例2: Start

    // initialized sprites
    void Start()
    {
        AsyncIO.ForceDotNet.Force();
        calImages = new Sprite[10];
        calImages[0] = Resources.Load<Sprite>("notargets");
        calImages[1] = Resources.Load<Sprite>("targetTL");
        calImages[2] = Resources.Load<Sprite>("targetTM");
        calImages[3] = Resources.Load<Sprite>("targetTR");
        calImages[4] = Resources.Load<Sprite>("targetML");
        calImages[5] = Resources.Load<Sprite>("targetMM");
        calImages[6] = Resources.Load<Sprite>("targetMR");
        calImages[7] = Resources.Load<Sprite>("targetBL");
        calImages[8] = Resources.Load<Sprite>("targetBM");
        calImages[9] = Resources.Load<Sprite>("targetBR");

        calCount = 0;
        curCount = 0;
        gameObject.GetComponent<Image> ().sprite = calImages [calCount];
        //max coords 1180*564
        transX = 0;
        transY = 0;
        targetPrefab = GameObject.FindGameObjectWithTag ("RaycastTarget");
        targetPrefab.SetActive (false);
        targetPrefab.layer = 2;//ignore raycast layer
        isVisible = false;

        AsyncIO.ForceDotNet.Force();
        //setup sockets
        //hangs????
        //http://forum.unity3d.com/threads/netmq-basic.298104/
        //must compile myself
        //https://github.com/zeromq/netmq/issues/98
        context = NetMQContext.Create ();
        server = context.CreatePublisherSocket ();
        server.Bind("tcp://127.0.0.1:5556");
        client = context.CreateSubscriberSocket ();
        client.Connect("tcp://127.0.0.1:5556");
        client.Subscribe ("coord");
        Debug.Log (System.Environment.Version);
        /*server.SendMore("coord").Send ("200 200");
        string top = client.ReceiveString ();
        string message = client.ReceiveString ();
        Debug.Log (message);
        string[] coord = message.Split ();
        transX = int.Parse (coord [0]);
        transY = int.Parse (coord [1]);*/
    }
开发者ID:VirtualVision,项目名称:VirtualVisionUnity,代码行数:48,代码来源:HUDPluginImageScript.cs

示例3: Execute

 public void Execute(NetMQSocket socket)
 {
     #pragma warning disable 618
     socket.Subscribe(_topic);
     #pragma warning restore 618
 }
开发者ID:AlonAmsalem,项目名称:ServiceBlocks,代码行数:6,代码来源:SubscribeCommand.cs


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