B
Bernhard Kuemel
Hi clc!
Can I write(2) much data (512K) to /dev/ttyS0 on Linux without blocking?
I want to be able to abort/flush the write if the microcontroller which
receives the data reports an error.
At first I planned to write byte wise, but select_tut recommends against
this [1] ... although at 115200 bps this might be acceptable. If I write
byte wise, how long could write() block once the buffer filled up? Until
a character has been transmitted, or is there a hysteresis?
Also I could try to abort/flush the write if a signal handler receives
the error. I would, however, like to keep the program simple, for the
moment.
Thanks, Bernhard
[1]
6. Never read/write only in single bytes at a time unless you
are really sure
that you have a small amount of data to process. It is
extremely inefficient
not to read/write as much data as you can buffer each time.
The buffers in
the example below are 1024 bytes although they could easily
be made larger.
Can I write(2) much data (512K) to /dev/ttyS0 on Linux without blocking?
I want to be able to abort/flush the write if the microcontroller which
receives the data reports an error.
At first I planned to write byte wise, but select_tut recommends against
this [1] ... although at 115200 bps this might be acceptable. If I write
byte wise, how long could write() block once the buffer filled up? Until
a character has been transmitted, or is there a hysteresis?
Also I could try to abort/flush the write if a signal handler receives
the error. I would, however, like to keep the program simple, for the
moment.
Thanks, Bernhard
[1]
6. Never read/write only in single bytes at a time unless you
are really sure
that you have a small amount of data to process. It is
extremely inefficient
not to read/write as much data as you can buffer each time.
The buffers in
the example below are 1024 bytes although they could easily
be made larger.