Contents of a message received from a beacon.
コード例 #1
0
ファイル: NetMQBeacon.cs プロジェクト: r618/netmq
        /// <summary>
        /// Receives the next beacon message if one is available before <paramref name="timeout"/> expires.
        /// </summary>
        /// <param name="timeout">The maximum amount of time to wait for the next beacon message.</param>
        /// <param name="message">The received beacon message.</param>
        /// <returns><c>true</c> if a beacon message was received, otherwise <c>false</c>.</returns>
        public bool TryReceive(TimeSpan timeout, out BeaconMessage message)
        {
            string peerName;

            if (!m_actor.TryReceiveFrameString(timeout, out peerName))
            {
                message = default(BeaconMessage);
                return(false);
            }

            var bytes = m_actor.ReceiveFrameBytes();

            message = new BeaconMessage(bytes, peerName);
            return(true);
        }
コード例 #2
0
ファイル: NetMQBeacon.cs プロジェクト: sharpe5/netmq
        /// <summary>
        /// Receives the next beacon message if one is available before <paramref name="timeout"/> expires.
        /// </summary>
        /// <param name="timeout">The maximum amount of time to wait for the next beacon message.</param>
        /// <param name="message">The received beacon message.</param>
        /// <returns><c>true</c> if a beacon message was received, otherwise <c>false</c>.</returns>
        public bool TryReceive(TimeSpan timeout, out BeaconMessage message)
        {
            string peerName;
            if (!m_actor.TryReceiveFrameString(timeout, out peerName))
            {
                message = default(BeaconMessage);
                return false;
            }

            var bytes = m_actor.ReceiveFrameBytes();

            message = new BeaconMessage(bytes, peerName);
            return true;
        }