Home > Net >  A serial port maximum can receive how many bytes at a time
A serial port maximum can receive how many bytes at a time

Time:09-20

Under a machine sent 5000 bytes at a time, through a serial port receives a time I can only accept 4096 bytes, the remaining bytes must send a command, the lower machine to return data, return data consists of two parts, the first part is just confiscated the data, data, part 2 of this command should return feeling buffer is only 4096.
Set to a larger buffer doesn't work, consult, under the condition of without changing the hypogyny machine, is likely to change PC, PC can receive the 5000 data at a time

CodePudding user response:

Since a serial port is a serial, so every time can only send a binary data, how many bytes as to what you say, this is your computer the size of the buffer, this is your own control, your memory is big, make a 100 gb is ok in theory,

CodePudding user response:

Buffer to a receiving data size, and buffer is set up your own

CodePudding user response:

Even if you set the so-called buffer to 1 byte, is also acceptable finished 5000 bytes of the message content,

When processing method DataReceived, to deal with continuously processing receive events trigger the lock, don't you think that trigger an event, perform a Read statement even out a message?

CodePudding user response:

Entangled with a look at your so-called buffer should be more "big", can see a problem here, this value is set a small, set up 5000 calculating do not calculate is too small? Set to 1 m is too small? Under the so-called one thousand from good news on machine is 1 m, 1 byte?

This problem from the faulty logic, there is no answer,

CodePudding user response:

Send a machine automatically the subcontract, the maximum is 4096, when more than 4096, you will need in PC group package, each baotou plus a number

CodePudding user response:

Serial receiving, now the worst single chip microcomputer can perfectly capable of handling, so there is no flow control, didn't you notice the favour not favour, have time to receive,
Data have not been dealing with you, of course, will overflow, or you have to wait until 5 k processing, generally only 1 byte buffer serial interface hardware, other are made the staging system own memory buffer, and it is not a great general, their best set a memory, depend on your memory size, interrupt message processing serial data, to its own buffer, wait until the bytes to, you need to read from the buffer, so it is very flexible,
A serial port is streaming data, and to think in uninterrupted flow data, the data flow is not strips, but continuous, agreement your head to tail, determinate structure, can very good data from the stream data and identification of agreement,
  •  Tags:  
  • C#
  • Related