TCP 内部服务套接字数据发送
Inheritance: TcpServer.ServerSocketSender
Example #1
0
        public void Set(ServerSocketSender socket, serverType serverValue, TcpServer.ServerTaskType taskType)
        {
            this.Sender      = socket;
            this.serverValue = serverValue;
            CommandIndex     = socket.ServerSocket.CommandIndex;
            //CommandFlags = CommandIdentity.GetCommandFlags();
            switch (taskType)
            {
            case TcpServer.ServerTaskType.ThreadPool: if (!System.Threading.ThreadPool.QueueUserWorkItem(ThreadPoolCall))
                {
                    AutoCSer.Threading.TaskSwitchThreadArray.Default.CurrentThread.Add(this);
                }
                return;

            case TcpServer.ServerTaskType.Timeout: AutoCSer.Threading.TaskSwitchThreadArray.Default.CurrentThread.Add(this); return;

            case TcpServer.ServerTaskType.TcpTask: TcpServer.ServerCallThreadArray.Default.CurrentThread.Add(this); return;

            case TcpServer.ServerTaskType.TcpQueue: TcpServer.ServerCallQueue.Default.Add(this); return;

            case TcpServer.ServerTaskType.TcpQueueLink: TcpServer.ServerCallQueue.DefaultLink.Add(this); return;

            case TcpServer.ServerTaskType.Queue: socket.Server.CallQueue.Add(this); return;

            case TcpServer.ServerTaskType.QueueLink: socket.Server.CallQueueLink.Add(this); return;
            }
        }
Example #2
0
 public void Set(ServerSocketSender sender, serverType serverValue, AutoCSer.Net.TcpServer.ServerCallQueue queue)
 {
     this.Sender      = sender;
     this.serverValue = serverValue;
     CommandIndex     = sender.ServerSocket.CommandIndex;
     //CommandFlags = CommandIdentity.GetCommandFlags();
     queue.Add(this);
 }
Example #3
0
        public void Set(ServerSocketSender sender, serverType serverValue, TcpServer.ServerTaskType taskType, byte callQueueIndex)
        {
            this.Sender      = sender;
            this.serverValue = serverValue;
            CommandIndex     = sender.ServerSocket.CommandIndex;
            //CommandFlags = CommandIdentity.GetCommandFlags();
            switch (taskType)
            {
            case TcpServer.ServerTaskType.Queue: sender.Server.CallQueueArray[callQueueIndex].Key.Add(this); return;

            case TcpServer.ServerTaskType.QueueLink: sender.Server.CallQueueArray[callQueueIndex].Value.Add(this); return;
            }
        }
        internal void Set(ServerSocketSender sender, ref TcpServer.ServerAttributeCache attribute, RemoteType[] inputParameter)
        {
            this.Sender         = sender;
            CommandIndex        = sender.ServerSocket.CommandIndex;
            this.inputParameter = inputParameter;
            switch (attribute.RemoteExpressionTask)
            {
            case TcpServer.ServerTaskType.ThreadPool: if (!System.Threading.ThreadPool.QueueUserWorkItem(ThreadPoolCall))
                {
                    AutoCSer.Threading.LinkTask.Task.Add(this);
                }
                return;

            case TcpServer.ServerTaskType.Timeout: AutoCSer.Threading.LinkTask.Task.Add(this); return;

            case TcpServer.ServerTaskType.TcpTask: TcpServer.ServerCallTask.Task.Add(this); return;

            case TcpServer.ServerTaskType.TcpQueue: TcpServer.ServerCallQueue.Default.Add(this); return;

            case TcpServer.ServerTaskType.TcpQueueLink: TcpServer.ServerCallQueue.DefaultLink.Add(this); return;

            case TcpServer.ServerTaskType.Queue:
                if (attribute.RemoteExpressionCallQueueIndex == 0)
                {
                    sender.Server.CallQueue.Add(this);
                }
                else
                {
                    sender.Server.CallQueueArray[attribute.RemoteExpressionCallQueueIndex].Key.Add(this);
                }
                return;

            case TcpServer.ServerTaskType.QueueLink:
                if (attribute.RemoteExpressionCallQueueIndex == 0)
                {
                    sender.Server.CallQueueLink.Add(this);
                }
                else
                {
                    sender.Server.CallQueueArray[attribute.RemoteExpressionCallQueueIndex].Value.Add(this);
                }
                return;
            }
        }
 /// <summary>
 /// 调用处理
 /// </summary>
 public override void Call()
 {
     if (Sender.IsSocket)
     {
         AutoCSer.Net.TcpServer.ReturnValue <RemoteExpression.ReturnValue.Output> value = new AutoCSer.Net.TcpServer.ReturnValue <RemoteExpression.ReturnValue.Output>();
         try
         {
             value.Value.Return = inputParameter.GetReturnValue();
             value.Type         = AutoCSer.Net.TcpServer.ReturnType.Success;
         }
         catch (Exception error)
         {
             value.Type = AutoCSer.Net.TcpServer.ReturnType.ServerException;
             Sender.AddLog(error);
         }
         Sender.Push(CommandIndex, Sender.IsServerBuildOutputThread ? RemoteExpression.ReturnValue.Output.OutputThreadInfo : RemoteExpression.ReturnValue.Output.OutputInfo, ref value);
     }
     Sender = null;
     inputParameter.SetNull();
     AutoCSer.Threading.RingPool <GetRemoteExpressionServerCall> .Default.PushNotNull(this);
 }
        internal void Set(ServerSocketSender sender, TcpServer.ServerTaskType taskType, ref RemoteExpression.ClientNode inputParameter)
        {
            this.Sender         = sender;
            CommandIndex        = sender.ServerSocket.CommandIndex;
            this.inputParameter = inputParameter;
            switch (taskType)
            {
            case TcpServer.ServerTaskType.ThreadPool: if (!System.Threading.ThreadPool.QueueUserWorkItem(threadPoolCall))
                {
                    AutoCSer.Threading.LinkTask.Task.Add(this);
                }
                return;

            case TcpServer.ServerTaskType.Timeout: AutoCSer.Threading.LinkTask.Task.Add(this); return;

            case TcpServer.ServerTaskType.TcpTask: TcpServer.ServerCallTask.Task.Add(this); return;

            case TcpServer.ServerTaskType.TcpQueue: TcpServer.ServerCallQueue.Default.Add(this); return;

            case TcpServer.ServerTaskType.Queue: sender.Server.CallQueue.Add(this); return;
            }
        }
Example #7
0
 protected void push(callType call)
 {
     Sender      = null;
     serverValue = null;
     AutoCSer.Threading.RingPool <callType> .Default.PushNotNull(call);
 }