title: Serial Port Connection, Readline/ReadExisting Does Not Work
body: <p>I'm trying to make a serial connection to another machine. I'm using a Virtual Serial Port Emulator to try this. The settings that I use on hyperterminal are like the ones below. I can see the portopen is <code>true</code>, but I can't check whether I can write or read.  When I try the <code>ReadLine</code> method it gives <code>TimeoutException</code> and when it's readExisting command it does nothing. <code>DataReceived</code> is never triggered too. Can you help me out with that ? </p>
  
  <pre><code> private void Page1_Load(object sender, EventArgs e)
          {
  
          //Port name can be identified by checking the ports
  
  
          // section in Device Manager after connecting your device
          serialPort1.PortName = "COM14"; // that one works for me
  
          //Provide the name of port to which device is connected
  
          //default values of hardware[check with device specification document]
          serialPort1.BaudRate = 115200;
          serialPort1.Parity = Parity.None;
          serialPort1.DataBits = 8;
          serialPort1.StopBits = StopBits.One;
          serialPort1.Handshake = Handshake.None;
          serialPort1.RtsEnable = true;
          serialPort1.DtrEnable = true;
          serialPort1.ReceivedBytesThreshold = 8;
          serialPort1.ReadTimeout = 2000;
          serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceived);  //
          // Writes data to the Serial Port output buffer 
  
          //opens the port
          serialPort1.Open();
      }
  
        private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
      {
  
  
          inputData = serialPort1.ReadExisting();
          this.Invoke((MethodInvoker)delegate { DoUpdate(); });
  
  
      }
  
       public void DoUpdate()
      {
          textOutput.Text = (textOutput.Text + inputData);
  
      }
  
       private void btnReadExist_Click(object sender, EventArgs e)
      {
  
          if ((serialPort1.IsOpen == true))
          {
  
  
             serialPort1.WriteLine("something"); 
             string read= serialPort1.ReadExisting();
             //string output = serialPort1.ReadLine();
             textOutput.Text += read;
  
          }
      }
  
  
      private void Page1_FormClosed(object sender,System.Windows.Forms.FormClosedEventArgs e)
      {
          //  Close the Serial Port
            serialPort1.Close();
      }
  </code></pre>