Add support to block and non-block mode. General configuration in .h file. Buf fixed.