calc max sent length