Use blocking sockets instead of usleep()