public function getResponses(array $sockets, $timeout, $stream_timeout)
    {

        // Set the loop to active
        $loop_active = true;

        // Will hold the responses read from the sockets
        $responses = [];

        // To store the sockets
        $sockets_tmp = [];

        // Loop and pull out all the actual sockets we need to listen on
        foreach ($sockets as $socket_id => $socket_data) {
            // Get the socket
            /* @var $socket \GameQ\Query\Core */
            $socket = $socket_data['socket'];

            // Append the actual socket we are listening to
            $sockets_tmp[$socket_id] = $socket->get();

            unset($socket);
        }

        // Init some variables
        $read = $sockets_tmp;
        $write = null;
        $except = null;

        // Check to see if $read is empty, if so stream_select() will throw a warning
        if (empty($read)) {
            return $responses;
        }

        // This is when it should stop
        $time_stop = microtime(true) + $timeout;

        // Let's loop until we break something.
        while ($loop_active && microtime(true) < $time_stop) {
            // Check to make sure $read is not empty, if so we are done
            if (empty($read)) {
                break;
            }

            // Now lets listen for some streams, but do not cross the streams!
            $streams = stream_select($read, $write, $except, 0, $stream_timeout);

            // We had error or no streams left, kill the loop
            if ($streams === false || ($streams <= 0)) {
                break;
            }

            // Loop the sockets that received data back
            foreach ($read as $socket) {
                /* @var $socket resource */

                // See if we have a response
                if (($response = fread($socket, 8192)) === false) {
                    continue; // No response yet so lets continue.
                }

                // Check to see if the response is empty, if so we are done with this server
                if (strlen($response) == 0) {
                    // Remove this server from any future read loops
                    unset($sockets_tmp[(int)$socket]);
                    continue;
                }

                // Add the response we got back
                $responses[(int)$socket][] = $response;
            }

            // Because stream_select modifies read we need to reset it each time to the original array of sockets
            $read = $sockets_tmp;
        }

        // Free up some memory
        unset($streams, $read, $write, $except, $sockets_tmp, $time_stop, $response);

        // Return all of the responses, may be empty if something went wrong
        return $responses;
    }