implement receive timeout

Hi, would you consider merging this feature?