Beispiel #1
0
        //   bool m_ReceivingIsBusy;

        public DiscoveryServer()
        {
            m_Id               = "WSDiscoveryServer";
            m_ServerPort       = 30000;
            m_RemoteServerPort = m_ServerPort;
            m_serverSocket     = null;
            m_dataStream       = new byte[4096];
            m_dataStream[0]    = 0;
            m_DiscoveryClients = new DiscoveryClients();
            m_DiscoveryClients.RecoveryHandler += DiscoveryClients_RecoveryHandler;

            m_localIPAdress        = GetLocalIPv4(NetworkInterfaceType.Ethernet);
            m_DiscoverySearchEvent = new ManualResetEvent(false);
            m_DiscoveryCancelEvent = new ManualResetEvent(false);

            m_RecoveryData = new List <string>();
            //         m_ReceivingIsBusy = false;
        }
Beispiel #2
0
        private void DiscoveryClients_RecoveryHandler(object obj, DiscoveryEvent @event)
        {
            DiscoveryClients discoveryClients = obj as DiscoveryClients;

            if (discoveryClients != null)
            {
                if (@event.EventType == DiscoveryEvent.EventTypes.startEvent)
                {
                    m_RecoveryData.Clear();
                    m_DiscoverySearchEvent.Reset();
                }
                else
                if (@event.EventType == DiscoveryEvent.EventTypes.dataEvent)
                {
                    m_RecoveryData.Add(@event.Url);
                }
                else if (@event.EventType == DiscoveryEvent.EventTypes.endEvent)
                {
                    m_DiscoverySearchEvent.Set();
                }
            }
        }