/// <summary> /// Remote procedure /// </summary> /// <param name="req"></param> /// <param name="timeout"></param> /// <returns></returns> public async Task <byte[]> RpcAsync(byte[] req, int timeout) { // get identifier var id = _dataProcessor.GetIdentifier(req); if (id == null) { _logger.LogError("Identifier not found."); return(null); } // send return(await _dataSynchronizator.ExecuteActionAndWaitForResult(Encoding.ASCII.GetString(id), timeout, () => { bool status = _socketClient?.Send(req).GetAwaiter().GetResult() ?? false; if (!status) { _logger.LogError("Failed to sent message."); } return status; })); }