> > A single read() call should never ever return data from more than > > one frame. The last of multiple partial reads will just return > > the remaining bytes of the current frame. > > So if read() returns less than the number of bytes requested then that > is the end of the frame, but if read() returns the number of bytes > requested than that may or may not be the end of the frame. Still > doesn't work. > > But we could make it work, e.g.: > > > Method A: Return value of 0 from read() is a frame boundary. > If a read() call returns the last bytes of a frame, then the > next read() call must return 0 bytes (no error, just a successful read > of 0 bytes). The next read() after that returns the first data of the > next frame. This one. If we flag frame borders with 0 byte reads (i.e. EOF), then it should be done unconditionally. That will have the side effect that tools like cat will stop reading after they got one full frame btw. Gerd -- Gerd Knorr <kraxel@xxxxxxxxxxx> -- SuSE Labs, Außenstelle Berlin