private byte[] recv(Socket socket, int flags) {
        if (socket == null)
            throw new IllegalArgumentException("socket parameter must not be null");

        data = socket.recv(flags);
        more = socket.hasReceiveMore();
        return data;
    }