/// <summary> /// We have recieved a session announcment. /// </summary> /// <param name="recievedView">Announced session.</param> public override void RecieveData(View recievedView) { var sessionAnnouncment = recievedView as SessionAnnouncment; bool searching = _mode == AnnounceMode.Search, recievedAnnouncment = sessionAnnouncment != null && sessionAnnouncment.RemoteHostIP != null; if (searching && recievedAnnouncment) { Session.OnFoundSession(sessionAnnouncment.HostID, sessionAnnouncment.RemoteHostIP); // Stop recieving new broadcasts till a new finder is initialized. _mode = AnnounceMode.Passive; } }
/// <summary> /// Populates the host information to announce. /// </summary> /// <param name="hostID">ID of the host to announce.</param> public SessionAnnouncment(int hostID) { // Announce that the given host id has started a new session. HostID = hostID; _mode = AnnounceMode.Broadcast; }
/// <summary> /// Sets the SessionAnnouncment to recieve. /// </summary> public SessionAnnouncment() { _mode = AnnounceMode.Search; }