示例#1
0
 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");
 }
示例#2
0
        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;
        }
示例#3
0
        public ConsoleReceiver(Action <UciRequest, string> action)
        {
            var stream = new StreamReader(Console.OpenStandardInput());

            _readInputThread = new ThreadWrapper(() => ReadStream(stream, DataType.Stdout, action, "CONSOLE_RECEIVER"), "Console Receiver");
        }
示例#4
0
 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");
 }