private void Run(String[] args)
        {
            if (!ParseCommandLine(args))
            {
                return;
            }

            SessionOptions.ServerAddress[] servers
                = new SessionOptions.ServerAddress[d_hosts.Count];

            for (int i = 0; i < d_hosts.Count; ++i)
            {
                servers[i]
                    = new SessionOptions.ServerAddress(d_hosts[i], d_port);
            }

            SessionOptions sessionOptions = new SessionOptions();

            sessionOptions.ServerAddresses            = servers;
            sessionOptions.DefaultSubscriptionService = d_service;
            sessionOptions.DefaultTopicPrefix         = "ticker";
            // normally defaults to "ticker"
            sessionOptions.AuthenticationOptions      = d_authOptions;
            sessionOptions.AutoRestartOnDisconnection = true;
            sessionOptions.NumStartAttempts           = servers.Length;

            Console.WriteLine("Connecting to");
            foreach (SessionOptions.ServerAddress server in
                     sessionOptions.ServerAddresses)
            {
                Console.WriteLine(" " + server);
            }
            Console.WriteLine();

            Session session = new Session(sessionOptions);

            if (!session.Start())
            {
                for (;;)
                {
                    Event e = session.TryNextEvent();
                    if (e == null)
                    {
                        break;
                    }
                    PrintMessage(e);
                }
                Console.Error.WriteLine("Failed to start session.");
                return;
            }

            Identity identity = null;

            if (d_authOptions != null)
            {
                bool isAuthorized = false;
                identity = session.CreateIdentity();
                if (session.OpenService("//blp/apiauth"))
                {
                    Service authService = session.GetService("//blp/apiauth");
                    isAuthorized = Authorize(authService,
                                             identity,
                                             session,
                                             new CorrelationID());
                }
                else
                {
                    Console.Error.WriteLine("Failed to open //blp/apiauth.");
                }
                if (!isAuthorized)
                {
                    Console.Error.WriteLine("No authorization");
                    return;
                }
            }

            String fieldsString = "?fields=";

            for (int iField = 0; iField < d_fields.Count; ++iField)
            {
                if (0 != iField)
                {
                    fieldsString += ",";
                }
                fieldsString += d_fields[iField];
            }

            // NOTE: resources used by a snapshot request template are
            // released only when 'RequestTemplateTerminated' message
            // is received or when the session is destroyed.  In order
            // to release resources when request template is not needed
            // anymore, user should call the 'Session.cancel' and pass
            // the correlation id used when creating the request template,
            // or call 'RequestTemplate.close'. If the 'Session.cancel'
            // is used, all outstanding requests are canceled and the
            // underlying subscription is closed immediately. If the
            // handle is closed with the 'RequestTemplate.close', the
            // underlying subscription is closed only when all outstanding
            // requests are served.
            Console.WriteLine("Creating snapshot request templates\n");
            List <RequestTemplate> snapshots = new List <RequestTemplate>();

            for (int iTopic = 0; iTopic < d_topics.Count; ++iTopic)
            {
                String subscriptionString
                    = d_service + d_topics[iTopic] + fieldsString;
                RequestTemplate requestTemplate
                    = session.createSnapshotRequestTemplate(
                          subscriptionString,
                          new CorrelationID(iTopic),
                          identity);
                snapshots.Add(requestTemplate);
            }

            int eventCount = 0;

            while (true)
            {
                Event eventObj = session.NextEvent(1000);
                foreach (Message msg in eventObj)
                {
                    if (eventObj.Type == Event.EventType.RESPONSE ||
                        eventObj.Type == Event.EventType.PARTIAL_RESPONSE)
                    {
                        long   iTopic = msg.CorrelationID.Value;
                        String topic  = d_topics[(int)iTopic];
                        Console.WriteLine(topic + " - SNAPSHOT - ");
                    }
                    Console.WriteLine(msg);
                }
                if (eventObj.Type == Event.EventType.RESPONSE)
                {
                    if (++eventCount >= d_maxEvents)
                    {
                        break;
                    }
                }
                if (eventObj.Type == Event.EventType.TIMEOUT)
                {
                    Console.WriteLine(
                        "Sending request using the request templates\n");
                    for (int iTopic = 0; iTopic < snapshots.Count; ++iTopic)
                    {
                        session.SendRequest(snapshots[iTopic],
                                            new CorrelationID(iTopic));
                    }
                }
            }
        }