Exemplo n.º 1
0
 /// <summary>
 /// Runs this instance.
 /// </summary>
 /// <returns></returns>
 protected override bool Run()
 {
     if (mOnRun != null)
     {
         ContextRunEventArgs <TReplyCode, TReply, TContext> crea = new ContextRunEventArgs <TReplyCode, TReply, TContext>((TContext)this);
         mOnRun(this, crea);
         return(crea.ReturnValue);
     }
     return(true);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the client connection.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="eventArgs">The event args.</param>
 protected override void DoExecute(object sender, ContextRunEventArgs <TReplyCode, TReply, TContext> eventArgs)
 {
     eventArgs.Context.TcpConnection.Socket.CheckForDataOnSource();
     eventArgs.Context.TcpConnection.Socket.CheckForDisconnect();
     eventArgs.ReturnValue = true;
     while (eventArgs.Context.TcpConnection.Connected() &&
            mCommandHandlers.HandleCommand(eventArgs.Context))
     {
         System.Threading.Thread.Sleep(5);                 // prevent cpu from going 100%
     }
     if (eventArgs.ReturnValue &&
         eventArgs.Context.TcpConnection != null)
     {
         eventArgs.ReturnValue = eventArgs.Context.TcpConnection.Connected();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Handles the client connection.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="eventArgs">The event args.</param>
 protected abstract void DoExecute(object sender, ContextRunEventArgs <TReplyCode, TReply, TContext> eventArgs);