Home > Software engineering >  Vb serial communication buffer will not clear
Vb serial communication buffer will not clear

Time:09-27

After sending a set of data for the first time, return to normal data

Then send a set of data, but this time the data returned is the first time the data returned.

Can only send it again, the data returned is normal, I step through the program of receiving part found an error when the last data is received
I set up a MSComm1 OutBufferSize=6 why can also receive greater than the number of bytes?
Why is this

CodePudding user response:

Will MSComm Inputlen attribute is set to 0. Said a read the entire buffer
After reading will clear the cache.

CodePudding user response:

OutBufferSize is send buffer size, and what is the relationship between the receive buffer?
Receive buffer should be InputBufferSize (didn't check the document should be the)

CodePudding user response:

refer to the second floor Tiger_Zhao response:
OutBufferSize is the size of the send buffer, and what is the relationship between the receive buffer?
Receive buffer should be InputBufferSize (didn't check the document should be the)

InBufferSize attribute


Set and returns the number of bytes to receive buffer.

Syntax

Object. InBufferSize [=value]

InBufferSize attribute syntax consists of the following parts:

Part of the description
Object expression, and its value is "applied" in the list of objects,
Value integer expression that receives the number of bytes of buffer,


Description

InBufferSize refers to the total size of the receive buffer, the default value is 1024 bytes, not to confused with InBufferCount attribute, the attribute InBufferCount property returns the current number of characters waiting in the receive buffer,

Pay attention to the receive buffer is larger then the application available memory is smaller, but to accept the buffer is too small, if do not use the handshake protocol, may have the danger of overflow, the general rule is, first of all set a 1024 - byte buffer, if there is an overflow error, is by increasing the size of the buffer to control the transmission rate of application

Data type

The Integer
  • Related