Ejemplo n.º 1
0
        public String composeStatusMessage()
        {
            String status = "<?xml version=\"1.0\"?><status>";

            status = status + "<updateService ip=\"" + Broadcaster.getOwnIP() + "\" port=\"" + Properties.Settings.Default.updateProviderPort + "\"/>";
            status = status + LocationSourceManager.Instance.getLocationSourcesAsXml();
            status = status + "</status>";
            return(status);
        }
Ejemplo n.º 2
0
        public void Start()
        {
            if ((this.updateProviderThread != null) && (this.updateProviderThread.IsAlive))
            {
                return;
            }
            else
            {
                this.updateProviderThread = new Thread(new ThreadStart(ListenForUpdateClients));
                this.statusProviderThread = new Thread(new ThreadStart(HandleStatusRequests));

                this.updateProviderThread.Start();
                this.statusProviderThread.Start();
                this.Log("Server started on " + Broadcaster.getOwnIP() + ":" + Properties.Settings.Default.statusProviderPort);
            }
        }
Ejemplo n.º 3
0
        public void Start()
        {
            if (this.timer != null)
            {
                this.timer.Dispose();
                this.sock.Close();
                this.sock.Dispose();
            }

            this.sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            this.sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
            this.ip   = Broadcaster.getOwnIP();
            this.data = Encoding.ASCII.GetBytes("PresenceSimulator:" + ip);
            this.dest = new IPEndPoint(IPAddress.Broadcast, Properties.Settings.Default.BroadcastPort);

            AutoResetEvent autoEvent = new AutoResetEvent(false);

            this.timerDelegate = new TimerCallback(this.broadcast);
            this.timer         = new Timer(timerDelegate, autoEvent, 0, this.period);
        }