title: Writing through serial port
body: <p>below you can see my program output.While my device begin to boot, through serial port I send serialport1.write("\n"); and i topped the autoboot. then I must send three commands with serialport1.write command. if the thread sleeps before the command the commands are executed but i see the result after the commands done. I mean if i get slept the thread 1 sec before the commands, for 3 commands i see the result in richtextbox after 3 seconds. Why? Is there any other good way to executing the commands? my code is below.</p>
  
  <p>THE CODE:</p>
  
  <pre><code>_data = _serialPort.ReadExisting();
  if (_data.StartsWith("Hit"))
  {
      Thread.Sleep(1000);
      _serialPort.Write("\n");
      Thread.Sleep(200);
      _serialPort.Write("set moviargs...\n");
      Thread.Sleep(200);
      _serialPort.Write("saveenv\n");
      Thread.Sleep(200);
      _serialPort.Write("boot\n");
  }
  </code></pre>
  
  <p>THE OUTPUT:</p>
  
  <blockquote>
    <p>Hit any key to stop autoboot:  3  2  1
    0 </p>
    
    <p>SMDKV210 # set moviargs "setenv
    bootargs console=ttySAC2,115200
    smsc95xx.macaddr=00:09:DF:90:00:03"</p>
    
    <p>SMDKV210 # saveenv</p>
    
    <p>Saving Environment to SMDK bootable
    device...</p>
    
    <p>done</p>
    
    <p>SMDKV210 # boot</p>
  </blockquote>