/// <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); }
/// <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; }