> btw, is it necessarily to close() osql[1] in order to get res? > without close() the script seems is waiting for smth. > I'd like to get "res" in a loop: > write() > read() > write() > read() > ... > is it possible? Yes, call flush() each time you're done writing.