G
Guest
Hello
I have a question regarding the serialport.read() method.
SerialPort.Read Method (Byte[], Int32, Int32)
(http://msdn2.microsoft.com/en-us/library/ms143549.aspx).
Given that this method is called twice consequtively reading 4 bytes
each time:
_serialport.Read(buffer, 0, 4);
_serialport.Read(buffer, 0, 4);
Is it theoretically possible in this case that the 4 bytes read and
placed in the byte array 'buffer' the second time is the same as the
ones read the first time, or will the 4 bytes read the second time
for sure be 4 new bytes?
Given that the byte stream sent into the serial port is the following 8 bytes:
[A B C D A B C D]
and assume that the first Read() sets buffer= [A B C D].
Is it then possible for the second Read() to cause buffer=[B C D A] ?
(That is, for the Read() operation to cause only one new byte to be read; a
shift
by only one byte with respect to the input stream).
In case this is actually possible, how can one make certain that 4 new bytes
are read the second time?
Appreciate all the help I can get.
I have a question regarding the serialport.read() method.
SerialPort.Read Method (Byte[], Int32, Int32)
(http://msdn2.microsoft.com/en-us/library/ms143549.aspx).
Given that this method is called twice consequtively reading 4 bytes
each time:
_serialport.Read(buffer, 0, 4);
_serialport.Read(buffer, 0, 4);
Is it theoretically possible in this case that the 4 bytes read and
placed in the byte array 'buffer' the second time is the same as the
ones read the first time, or will the 4 bytes read the second time
for sure be 4 new bytes?
Given that the byte stream sent into the serial port is the following 8 bytes:
[A B C D A B C D]
and assume that the first Read() sets buffer= [A B C D].
Is it then possible for the second Read() to cause buffer=[B C D A] ?
(That is, for the Read() operation to cause only one new byte to be read; a
shift
by only one byte with respect to the input stream).
In case this is actually possible, how can one make certain that 4 new bytes
are read the second time?
Appreciate all the help I can get.