public async ValueTask <IConnection?> ConnectAsync(OmniAddress address, string serviceType, CancellationToken cancellationToken = default) { var cap = await _tcpConnector.ConnectAsync(address, cancellationToken); if (cap != null) { var connection = await this.InternalConnectAsync(cap, serviceType, cancellationToken); return(connection); } return(null); }
public async Task <IActionResult> Index(ICollection <IFormFile> files) { var uploads = Path.Combine(_environment.WebRootPath, "uploads"); foreach (var file in files) { if (file.Length > 0) { using (var reader = new StreamReader(file.OpenReadStream())) { var stream = reader.BaseStream; //await file.CopyToAsync(fileStream); //var stream = file.OpenReadStream(); string hostName = "localhost"; IPHostEntry ip = Dns.GetHostEntryAsync(hostName).Result; TcpConnector connector = new TcpConnector(ip.AddressList[1], 8080); await connector.ConnectAsync(stream); } } } return(View()); }