CreatePublisherSocket() 개인적인 메소드

private CreatePublisherSocket ( ) : PublisherSocket
리턴 PublisherSocket
        public void Start(int publishPort)
        {
            ctx = NetMQContext.Create();
            publishSocket = ctx.CreatePublisherSocket();

            publishSocket.Bind("tcp://*:" + publishPort);

            logger.Info("Message publisher started on port " + publishPort);
        }
예제 #2
0
 private void InitZmq()
 {
     if (_ctx == null)
     {
         _ctx = NetMQContext.Create();
         _socket = _ctx.CreatePublisherSocket();
         var address = string.Format("{0}:{1}", _host, _port);
         _socket.Bind(address);
     }
 }
    // 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]);*/
    }
예제 #4
0
파일: Channel.cs 프로젝트: bucknellu/Nyan
        private void SenderWorker()
        {
            _mqContext = NetMQContext.Create();
            _publisherSocket = _mqContext.CreatePublisherSocket();

            if (Protocol == "tcp")
                _publisherSocket.Connect(_address);

            if (Protocol == "pgm") //Multicast
            {
                _publisherSocket.Options.MulticastHops = 4;
                _publisherSocket.Options.MulticastRate = 40 * 1024; // 40 megabit
                _publisherSocket.Options.MulticastRecoveryInterval = TimeSpan.FromMinutes(10);
                _publisherSocket.Options.SendBuffer = 1024 * 10; // 10 megabyte
                _publisherSocket.Bind(_address);
            }

            _publisherSocket.SendReady += (s, a) => { };
        }
예제 #5
0
 public Broadcaster()
 {
     ctx = NetMQContext.Create();
     server = ctx.CreatePublisherSocket();
     server.Bind("tcp://127.0.0.1:5003");
 }
예제 #6
0
        /// <summary>
        /// Starts the publishing and request servers.
        /// </summary>
        public void StartServer()
        {
            if (!ServerRunning)
            {
                _context = NetMQContext.Create();

                //the publisher socket
                _pubSocket = _context.CreatePublisherSocket();
                _pubSocket.Bind("tcp://*:" + PublisherPort);

                //the request socket
                _reqSocket = _context.CreateSocket(ZmqSocketType.Rep);
                _reqSocket.Bind("tcp://*:" + RequestPort);
                _reqSocket.ReceiveReady += _reqSocket_ReceiveReady;

                _poller = new Poller(new[] { _reqSocket });
                Task.Factory.StartNew(_poller.Start, TaskCreationOptions.LongRunning);
            }
            ServerRunning = true;
        }