Exemplo n.º 1
0
        /// <summary>
        /// The init.
        /// </summary>
        private void Init()
        {
            lock (this.lockInit)
            {
                if (this.isInit)
                {
                    return;
                }

                this.isInit = true;

                // starting TCP-Listener to retreive connections
                this.tcpListener = new TcpListener(IPAddress.Any, this.config.TCPPort);
                this.tcpListener.Start();

                // starting a Thread to grab new TCP-Connections and wrap them into a EpicsTCPServerConnection
                this.connectionGrabber = new Thread(this.GrabConnection);
                this.connectionGrabber.IsBackground = true;
                this.connectionGrabber.Start();

                // opening the UDP-Listener
                this.udpConnection = new EpicsServerUDPConnection(this);
                if (this.Config.ProducingBeacon)
                {
                    this.beaconHandler = new Beaconizer(this.udpConnection, this.Config.BeaconPort);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The config_ config changed.
        /// </summary>
        /// <param name="propertyName">
        /// The property name.
        /// </param>
        private void config_ConfigChanged(string propertyName)
        {
            lock (this.lockInit)
            {
                if (!this.isInit)
                {
                    return;
                }

                if (propertyName == "UDPPort")
                {
                    this.beaconHandler.Dispose();
                    this.udpConnection.Dispose();

                    this.udpConnection = null;
                    this.udpConnection = new EpicsServerUDPConnection(this);
                    this.beaconHandler = new Beaconizer(this.udpConnection, this.Config.BeaconPort);
                }
                else if (propertyName == "TCPPort")
                {
                    this.tcpListener.Stop();
                    this.tcpListener = new TcpListener(IPAddress.Any, this.config.TCPPort);
                    this.tcpListener.Start();

                    this.connectionGrabber = new Thread(this.GrabConnection);
                    this.connectionGrabber.IsBackground = true;
                    this.connectionGrabber.Start();
                }
                else if (propertyName == "ProducingBeacon")
                {
                    if (this.Config.ProducingBeacon)
                    {
                        this.beaconHandler = new Beaconizer(this.udpConnection, this.Config.BeaconPort);
                    }
                    else
                    {
                        this.beaconHandler.Dispose();
                    }
                }
            }
        }