/// <summary>Creates a new client. A client can manage one connection to a server.</summary> /// <param name="dispatcherType">The message processing method for incomming notifications. /// See <see cref="EventDispatchType"/> for further information about each type.</param> public TsFullClient(DedicatedTaskScheduler?scheduler = null) { status = TsClientStatus.Disconnected; msgProc = new AsyncMessageProcessor(MessageHelper.GetToClientNotificationType); this.scheduler = scheduler ?? new DedicatedTaskScheduler(Id.Null); this.isOwnScheduler = scheduler is null; }
/// <summary> /// Starts the agent execution, after it has been created. /// First, the Setup method is called, and then the Act method is automatically called when the agent receives a /// message. /// </summary> /// <remarks>Synchronize the code with CognitiveAgent.Start</remarks> public virtual void Start() { State = AgentState.Starting; if (Environment == null) { throw new Exception("Environment is null in agent " + AgentId + " (ConcurrentAgent.Start)"); } //now in CreateAgent //InitializeModels(); //SetModels(); FinalizeModels(); // MessageProcessor initializing MessageProcessor = AsyncMessageProcessor.Start(async mp => { BeforeStart(); State = AgentState.Started; while (true) { var message = await mp.Receive().ConfigureAwait(false); Act(message); Environment.Messages.DeQueueWaitingMessage(message); } }); }
/// <summary>Creates a new client. A client can manage one connection to a server.</summary> /// <param name="dispatcherType">The message processing method for incomming notifications. /// See <see cref="EventDispatchType"/> for further information about each type.</param> public TsFullClient() { status = TsClientStatus.Disconnected; msgProc = new AsyncMessageProcessor(MessageHelper.GetToClientNotificationType); context = new ConnectionContext { WasExit = true }; }
public Ts3Server() { ts3Crypt = new Ts3Crypt(); ts3Crypt.Identity = Ts3Crypt.GenerateNewIdentity(0); packetHandler = new PacketHandler <C2S, S2C>(ts3Crypt); msgProc = new AsyncMessageProcessor(MessageHelper.GetToServerNotificationType); dispatcher = EventDispatcherHelper.Create(EventDispatchType.AutoThreadPooled); }
/// <summary>Creates a new client. A client can manage one connection to a server.</summary> /// <param name="dispatcherType">The message processing method for incomming notifications. /// See <see cref="EventDispatchType"/> for further information about each type.</param> public Ts3FullClient(EventDispatchType dispatcherType) { status = Ts3ClientStatus.Disconnected; ts3Crypt = new Ts3Crypt(); packetHandler = new PacketHandler(ts3Crypt); msgProc = new AsyncMessageProcessor(); dispatcher = EventDispatcherHelper.Create(dispatcherType); context = new ConnectionContext { WasExit = true }; }
public SolarAsyncWindServer(Channel channel, AsyncMessageProcessor callback) { _channel = channel ?? throw new ArgumentNullException(nameof(channel)); _processor = callback ?? throw new ArgumentNullException(nameof(callback)); _channel.SetCallback(OnCallback); }