Ejemplo n.º 1
0
        public Producer(string zkconfig, string topic)
        {
            zk = new ZKClient(zkconfig);
            zk.push(topic);
            broker = zk.findBroker();
            if (broker != null)
            {
                string[] uri = broker.brokerUri.Split(':');
                host = uri[0];
                port = Convert.ToInt32(uri[1]);
            }

            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            try
            {
                socket.Connect(host, port);
            }
            catch (SocketException e)
            {
                Debug.Write(e.ToString());
            }
        }
Ejemplo n.º 2
0
        public Producer(string zkconfig, string topic)
        {
            zk = new ZKClient(zkconfig);
            zk.push(topic);
            broker = zk.findBroker();
            if (broker != null)
            {
                string[] uri = broker.brokerUri.Split(':');
                host = uri[0];
                port = Convert.ToInt32(uri[1]);
            }

            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            try
            {
                socket.Connect(host, port);
            }
            catch (SocketException e)
            {
                Debug.Write(e.ToString());
            }

        }