i need to read data from my virtual com port and detect the message \"Dreq\". Once i press the connect button, it connects to my COM8 port and begins reading in a new thread
You can try calling sp.DiscardOutBuffer(). It will call your read callback and you can then use stream.EndRead().
sp.DiscardOutBuffer()
stream.EndRead()
private void disconnectButton_Click(object sender, EventArgs e) { sp.DiscardOutBuffer(); stream.EndRead(recv_result); sp.Close(); }