unify behaviour with tcp/udp read/write