If filling your 4k buffer on linux is the problem, you may be interested in
IPC3 buffer limit problem. On linux, you can detect if the buffer has anything in it, and then sysread it out. See "perldoc -q waiting". Of course you have to go thru the hassle of running "h2ph", see "perldoc h2ph". Of course the problem may be your program isn't writing to the buffer, unless it has a 4k chunk ready, then this won't work.