Improve send function for transmitting all prepared data.