#start timer; while (<$socket>) { # check timer # grab a bit of data }