changed write to writeAndFlush fixing the issue of delaying data transffer