Start() public method

Starts the UdpServer synchronously and begins accepting client connections asynchronously.
Attempt is made to the when it is running.
public Start ( ) : void
return void
Exemplo n.º 1
0
        private void m_reconnectTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                m_parent.OnStatusMessage("Attempting to restart data channel...");
                DataChannel = null;

                UdpServer dataChannel = new UdpServer(m_configurationString);
                dataChannel.Start();

                this.DataChannel = dataChannel;
                m_parent.OnStatusMessage("Data channel successfully restarted.");
            }
            catch (Exception ex)
            {
                m_parent.OnStatusMessage("Failed to restart data channel due to exception: {0}", ex.Message);
                m_reconnectTimer.Start();
            }
        }
        private void m_reconnectTimer_Elapsed(object sender, EventArgs<DateTime> e)
        {
            try
            {
                m_parent.OnStatusMessage(MessageLevel.Info, "Attempting to restart data channel...");
                DataChannel = null;

                UdpServer dataChannel = new UdpServer(m_configurationString);
                dataChannel.Start();

                DataChannel = dataChannel;
                m_parent.OnStatusMessage(MessageLevel.Info, "Data channel successfully restarted.");
            }
            catch (Exception ex)
            {
                m_parent.OnStatusMessage(MessageLevel.Warning, $"Failed to restart data channel due to exception: {ex.Message}");
                m_reconnectTimer.Start();
            }
        }