The simplest approach is just to set up a SerialPort (see
MSDN[
^] for the basics) then attach a handler to the SerialPort.DataReceived event
MSDN example[
^].
You could have found this with a simple Google...
"
If I set up the serial port the way presented in MSDN will i be able to open the same port with another app?
Not sure if I explained right, but i need to monitor (with my app) the serial communication between another app in my computer and an external device."
No. The normally, a physical Serial Port is a two - device link, and the SerialPort control mimics this. When the port is open, it can only be accessed by a single process on the entire machine - which makes sense, if you think about normal operations. You don't want data being read by two devices simultaneously because you would not get repeatable results.
You have two options: go with SerialPort Monitor that Rajesh suggested - I've never heard of it, so I can't comment on wetehre it would work - or go with a physical solution and wire the incoming data to two serial ports on the same PC. RS232 isn't supposed to be used like that, but it will do it provided you keep the number of machines to two or three (I have had six, but don't recommend it) and only wire up the RX and earth leads. Do not wire up TX or flow control - loop them back if you must instead.