Пример #1
0
        /// <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;
            }
        }
Пример #2
0
 /// <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;
 }
Пример #3
0
 /// <summary>
 /// Sets the SessionAnnouncment to recieve.
 /// </summary>
 public SessionAnnouncment()
 {
     _mode = AnnounceMode.Search;
 }