Simplify waiting for response for sockets