Friday, 9 August 2013

c# event handler after Serialport Write single byte

c# event handler after Serialport Write single byte

I was wondering if this is possible to have some kind of an event handler
in a separate thread/ process that fires when a single byte has been sent
using comport.Write(...).
Please consider this part of code:
public SerialPort comport = new SerialPort("COM1", 38400, Parity.Even, 8,
StopBits.One);
comport.Write(buf, 0, buf.Length);
Now lets say the buf.Lenght is 1000. My program stops untill i send all
1000 bytes. I would not like to divide the comport.Write, i just want to
use it once.
Is it possible now that everytime a byte is sent, some kind of event
handler can turn on to for example update process bar etc, without
interrupting the data sending to much (wont slow it).
Any help would be aprichiated.

No comments:

Post a Comment