/// <summary> /// TCP调用 /// </summary> /// <param name="identityCommand">命令信息</param> /// <param name="onCall">回调委托</param> /// <returns>保持回调</returns> public TcpServer.ReturnType CallAsync(TcpServer.CommandInfo identityCommand, TcpServer.TaskAsyncReturnValue onCall) { if (IsSocket) { ClientCommand.CallCommand command = AutoCSer.Threading.RingPool <ClientCommand.CallCommand> .Default.Pop() ?? new ClientCommand.CallCommand(); if (command != null) { command.Set(ClientSocket, identityCommand, onCall.Call); push(command); return(TcpServer.ReturnType.Success); } return(TcpServer.ReturnType.ClientException); } return(TcpServer.ReturnType.ClientDisposed); }
/// <summary> /// TCP调用 /// </summary> /// <typeparam name="inputParameterType">输入参数类型</typeparam> /// <param name="identityCommand">命令信息</param> /// <param name="onCall">回调委托</param> /// <param name="inputParameter">输入参数</param> /// <returns>保持回调</returns> public TcpServer.ReturnType CallAsync <inputParameterType>(TcpServer.CommandInfo identityCommand, TcpServer.TaskAsyncReturnValue onCall, ref inputParameterType inputParameter) where inputParameterType : struct { if (IsSocket) { ClientCommand.InputCommand <inputParameterType> command = AutoCSer.Threading.RingPool <ClientCommand.InputCommand <inputParameterType> > .Default.Pop() ?? new ClientCommand.InputCommand <inputParameterType>(); if (command != null) { command.Set(ClientSocket, identityCommand, onCall.Call, ref inputParameter); push(command); return(TcpServer.ReturnType.Success); } return(TcpServer.ReturnType.ClientException); } return(TcpServer.ReturnType.ClientDisposed); }
/// <summary> /// TCP调用(用于代码生成编译) /// </summary> /// <typeparam name="inputParameterType">输入参数类型</typeparam> /// <typeparam name="outputParameterType">输入参数类型</typeparam> /// <param name="identityCommand">命令信息</param> /// <param name="onCall">回调委托</param> /// <param name="inputParameter">输入参数</param> /// <returns>保持回调</returns> internal TcpServer.ReturnType CallAsync <inputParameterType, outputParameterType>(TcpServer.CommandInfo identityCommand, TcpServer.TaskAsyncReturnValue <outputParameterType> onCall, ref inputParameterType inputParameter) where inputParameterType : struct where outputParameterType : struct { throw new InvalidOperationException(); }