I'm using serialport in c# and my code is like this:
FileStream MyFile = new FileStream(strFileDestination, FileMode.Append);
BinaryWriter bwFile = new BinaryWriter(MyFile);
bwFile.Write(serialPort1.ReadExisting());
bwFile.Close();
MyFile.Close();
when I use
bwFile.Write(serialPort1.ReadByte());
instead of
bwFile.Write(serialPort1.ReadExisting());
, writing speed in file decreases from about 130 KB/s to 28 KB/s and when I use
bwFile.Write((byte)serialPort1.ReadByte());
, writing speed decreases to 7 KB/s. I want to know how Can I write in to file like the third command and have the speed 130 KB/s.