add recv timeout support; and fd_set_blocking helper function