use the new stream api in the recv & send command

This api is quite more efficient and simpler than the old onee so use it to
read and write to streams.