check frame length before receiving