in SimpleDUTRemote/HelperFunctions/LargeFileTransfers.cs [78:112]
public static void Download(string path, TcpListener server)
{
logger.Info($"Waiting for connection for directory transfer on port {((IPEndPoint)server.LocalEndpoint).Port}");
var connection = server.AcceptTcpClientAsync();
#if DEBUG
connection.Wait();
#else
bool status = connection.Wait(10 * 1000);
if (!status)
{
logger.Warn($"Timed out waiting for client to begin downloading directory. Closing port.");
server.Stop();
return;
}
#endif
server.Stop();
using (TcpClient client = connection.Result)
using (var stream =client.GetStream())
{
try
{
//var bytesSent = ZipFunctions.WriteDirectoryToStream(stream, path);
var bytesSent = TarFunctions.WriteFileOrDirectoryToStream(stream, path);
logger.Info($"Successfully sent {bytesSent} bytes, read from {path}");
}
catch (Exception e)
{
logger.Error(e, "Download failed");
return;
}
}
}