Skip to main content
6 events
when toggle format what by license comment
May 7, 2020 at 11:07 vote accept Walter ZAMBOTTI
May 6, 2020 at 21:21 comment added Kamil Maciorowski I knew socat is a powerful tool but I didn't know this trick. Thanks. +1.
May 6, 2020 at 21:19 history edited meuh CC BY-SA 4.0
added 242 characters in body
May 6, 2020 at 21:14 comment added meuh type=2 is a sort of "packet" mode, where each write made towards dd keeps its structure, so a dd read larger than the packet will only get one packet, thus preserving the "structure". If you provide your file as stdin to socat (as in <myfile socat -u ...), then socat will always be able to read the 256 bytes it is asked to. If you use a pipe, as in my example, and the command you are using to fill the pipe is only sending a few bytes at a time, socat might not get the full 256 bytes, and so will send a short packet to dd. So just ensure you provide your file as stdin directly.
May 6, 2020 at 20:35 comment added Kamil Maciorowski Seems to work. I tested with -b256 and bs=512, the output was identical to what bbe had given me. The manual says -b sends at most such-and-such number of bytes per step. When dd requests 512 bytes, will it always get exactly 256? If for any reason it gets less then the output will go out of sync. Does type=2 guarantee this exactness maybe?
May 6, 2020 at 17:40 history answered meuh CC BY-SA 4.0