in SimpleDUTRemote/JobSystem/Job.cs [209:255]
private bool CreateProgressStream(IPEndPoint streamEp)
{
bool connectionSuccessful = false;
// setup file streaming regardless of what happens on the network;
outputLogFilename = OUTPUT_LOG_BASENAME + DateTime.Now.ToString(OUTPUT_LOG_TIME_FORMAT) + ".txt";
outputLogFilename = Path.Combine(Path.GetTempPath(), outputLogFilename);
outputLogSteam = new StreamWriter(new FileStream(outputLogFilename, FileMode.Create));
logger.Info("Recording process output to: {0} .", outputLogFilename);
// make a note on the logfile what job this is and what was called.
outputLogSteam.WriteLine($"SimpleRemote Job {jobId} Output - {DateTime.Now:g}");
outputLogSteam.WriteLine($"{process.StartInfo.FileName} {process.StartInfo.Arguments}");
outputLogSteam.WriteLine();
var progressClient = new TcpClient();
progressClient.SendTimeout = NETWORK_TIMEOUT_MS;
try
{
if (!progressClient.ConnectAsync(streamEp.Address, streamEp.Port).Wait(NETWORK_TIMEOUT_MS))
{
// failed to connect due to timeout - log and proceed.
connectionSuccessful = false;
logger.Error("Failed to initiate network streaming progress - connection to client timed out ");
}
else
{
// connection successful
progressStream = new StreamWriter(progressClient.GetStream());
connectionSuccessful = true;
}
}
catch (Exception e)
{
if (e is SocketException || (e is AggregateException && e.InnerException is SocketException))
{
connectionSuccessful = false;
logger.Error("Failed to initiate network streaming progress - got socket exception while connecting");
}
else throw;
}
return connectionSuccessful;
}