Ejemplo n.º 1
0
        public bool Process()
        {
            _s = "Business flow...";
            Console.WriteLine("Send : {0}", _s);
            _sender.Send(_s);
            Console.WriteLine("Receive : {0}", _receiver.Read());

            return(false);
        }
Ejemplo n.º 2
0
        public bool Process()
        {
            switch (_step)
            {
            case 1:
                _sender.Send("=== Authentication ===\r\nUsername : "******"Password : ");
                if (Validate(_receiver.Read()))
                {
                    result = true;
                }
                break;

            default:
                break;
            }


            return(result);
        }
Ejemplo n.º 3
0
 private void Send()
 {
     if (!socketSender.Connected)
     {
         RaiseOnDisconnetedEvent();
     }
     else if (queue.Count != 0)
     {
         try
         {
             LinkedListNode <byte[]> first = queue.First;
             socketSender.Send(first.Value);
             ErrorCount = 0;
             queue.RemoveFirst();
             if (queue.Count > 0)
             {
                 fiber.Enqueue(Send);
             }
         }
         catch (ThreadAbortException)
         {
             throw;
         }
         catch (OutOfMemoryException)
         {
             throw;
         }
         catch (Exception exception)
         {
             ErrorCount++;
             RaiseErrorEvent(exception);
             if (log.IsDebugEnabled)
             {
                 log.DebugFormat("Publishing counter data failed for the {0} time: {1}", ErrorCount, exception);
             }
             if (MaxRetryCount > 0 && ErrorCount >= MaxRetryCount)
             {
                 Stop();
                 if (log.IsDebugEnabled)
                 {
                     log.DebugFormat("Maximum errors for publishing counter reached. Counter publisher has beeen stopped.", new object[0]);
                 }
             }
         }
     }
 }