Example #1
0
        /// <summary>
        /// Return our node UUID string, after successful initialization
        /// </summary>
        /// <returns>our node UUID string</returns>
        public Guid Uuid()
        {
            _actor.SendFrame("UUID");
            var uuidBytes = _actor.ReceiveFrameBytes();

            Debug.Assert(uuidBytes.Length == 16);
            _uuid = new Guid(uuidBytes);
            return(_uuid);
        }
Example #2
0
        public void Bind(string address)
        {
            m_actor.SendMoreFrame(BindCommand).SendFrame(address);

            byte[] bytes     = m_actor.ReceiveFrameBytes();
            int    errorCode = BitConverter.ToInt32(bytes, 0);

            if (errorCode != 0)
            {
                throw NetMQException.Create((ErrorCode)errorCode);
            }
        }
Example #3
0
        /// <summary>
        /// 地址绑定
        /// </summary>
        /// <param name="address"></param>
        public bool Bind(string address)
        {
            _actor.SendMoreFrame(BindCommand).SendFrame(address);

            byte[] bytes     = _actor.ReceiveFrameBytes();
            int    errorCode = BitConverter.ToInt32(bytes, 0);

            if (errorCode != 0)
            {
                Console.Error.WriteLine($"Bind {address} Failed");
                return(false);
            }
            return(true);
        }