title: Serial Port WriteLine sometimes fails
body: <p>I wrote a simple program which send an AT command over serial port.
  I followed the instruction 
  <a href="http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.open.aspx" rel="nofollow">MSDN EXAMPLE </a></p>
  
  <p>Serial Port (38400,N,8,1)</p>
  
  <pre><code>serialPort1.PortName = "COM" + "5";// textBox1.Text;
          try
          {
              if (!(serialPort1.IsOpen))
                  serialPort1.Open();
  
  
              // if (listBox1.SelectedIndex == 0 || listBox1.SelectedIndex == 1)
                  serialPort1.WriteLine("atrst");
              // else
              //     serialPort1.WriteLine("araprst");
  
              serialPort1.Close();
          }
          catch (Exception ex)
          {
              MessageBox.Show("Error opening/writing to serial port :: " + ex.Message, "Error!");
              Application.Exit();
          }
  </code></pre>
  
  <p>When I use the WriteLine command sometimes the AT command is not send to the port. 
  Any idea why?, 
  Is there a way to know the WriteLine(String) fail?</p>