static void Main(string[] args)
        {
            try
            {
                ParseArgs(args);

                // Send messages to queue which does not require session
                Console.Title = "Ping Client";

                // Create sender to Order Service
                ChannelFactory <IPingServiceContract> factory = new ChannelFactory <IPingServiceContract>(SampleManager.PingClientConfigName);
                IPingServiceContract clientChannel            = factory.CreateChannel();
                ((IChannel)clientChannel).Open();

                // Send messages
                numberOfMessages = random.Next(10, 30);
                Console.WriteLine("[Client{0}] Sending {1} messages to {2}...", senderId, numberOfMessages, SampleManager.PingQueueName);
                SendMessages(clientChannel);

                // Close sender
                ((IChannel)clientChannel).Close();
                factory.Close();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception occurred: {0}", exception);
                SampleManager.ExceptionOccurred = true;
            }

            Console.WriteLine("\nSender complete.");
            Console.WriteLine("\nPress [Enter] to exit.");
            Console.ReadLine();
        }
 static void SendMessages(IPingServiceContract clientChannel)
 {
     // Send messages to queue which requires session:
     for (int i = 0; i < numberOfMessages; i++)
     {
         // Send message
         PingData message = CreatePingData();
         clientChannel.Ping(message);
         SampleManager.OutputMessageInfo("Send", message);
         Thread.Sleep(200);
     }
 }