public NetworkSender(string host, int port, int connectionTimeOut, int heartbeatTimeOut) { if (connectionTimeOut <= 0) { connectionTimeOut = 60; } Helpers.WaitForServer(host, port, connectionTimeOut); _channel = new Channel($"{host}:{port}", ChannelCredentials.Insecure); _client = new Uci.UciClient(_channel); _heartbeatThread = new ThreadWrapper(() => CheckHeartbeat(heartbeatTimeOut), "Checkheartbeat"); }
public UciProxyHandler(Config config, bool revertDirection) { _logExchange = config.LogExchange; _lines = new ConcurrentQueue <UciRequest>(); _stop = false; _queueSenderThread = new ThreadWrapper(() => SendLines(), "LineSender"); var input = revertDirection ? config.Output : config.Input; var output = revertDirection ? config.Input : config.Output; _receiver = HandlerFactory.GetReceiver(input, Receive); _sender = HandlerFactory.GetSender(output); _delayMs = config.DelayMs > 0 ? config.DelayMs : 10; }
public ConsoleReceiver(Action <UciRequest, string> action) { var stream = new StreamReader(Console.OpenStandardInput()); _readInputThread = new ThreadWrapper(() => ReadStream(stream, DataType.Stdout, action, "CONSOLE_RECEIVER"), "Console Receiver"); }
public SubProcessConsoleReceiver(string executablePath, Action <UciRequest, string> action) { _process = ProcessManager.GetProcess(executablePath); _readOutputThread = new ThreadWrapper(() => ConsoleReceiver.ReadStream(_process.StandardOutput, DataType.Stdout, action, "SUB_PROCESS_STDOUT"), "SubProcessStdout"); _readErrorThread = new ThreadWrapper(() => ConsoleReceiver.ReadStream(_process.StandardError, DataType.Stderr, action, "SUB_PROCESS_STDERR"), "SubProcessStderr"); }