CodeTV.WinLIRC.WinLIRCThread C# (CSharp) Method

WinLIRCThread() private method

private WinLIRCThread ( ) : void
return void
        private void WinLIRCThread()
        {
            try
            {
                byte[] data = new byte[256];

                while (true)
                {
                    // Read the first batch of the TcpServer response bytes.
                    Int32 bytes = this.networkStream.Read(data, 0, data.Length);
                    string irCommand = System.Text.Encoding.ASCII.GetString(data, 0, bytes);

                    if (this.syncControl != null && this.syncControl.InvokeRequired)
                        this.syncControl.BeginInvoke(new CommandReceivedDelegate(this.OnCommandReceived), new object[] { irCommand });
                    else
                        OnCommandReceived(irCommand);
                }
            }
            catch (ArgumentNullException e)
            {
                Trace.WriteLineIf(MainForm.trace.TraceError, string.Format("ArgumentNullException: {0}", e));
            }
            catch (SocketException e)
            {
                Trace.WriteLineIf(MainForm.trace.TraceError, string.Format("SocketException: {0}", e));
            }
            catch (ThreadAbortException e)
            {
                Trace.WriteLineIf(MainForm.trace.TraceError, string.Format("Thread Aborted: {0}", e));
            }
        }