The problem is as follows.
I have a thread that connects to a Telnet, the problem is that sometimes the telnet is stuck, or the connection is lost momentarily and the program that connects with the telnet is pointing to nothing.
The problem this I treat so that, there is a parent thread, which is responsible for restarting the son thread every 30 minutes.
while (true)
{
/*
* Bucle que reinstancia el hilo, reiniciándolo para que cada X tiempo
* se relance el servicio sin importar como esté.
*/
error=false;
try
{
ThreadStart consola = new ThreadStart(telnetListener);
Thread thread = new Thread(consola);
thread.Start();
Thread.Sleep(1000 * 60 * 30);
thread.Abort();
}
catch (Exception e)
{
log("FALLO" + e.Message);
error = true;
}
The hierarchy is as follows.
Hilo padre
|
|Hilo hijo
|
| Escuchamos los mensajes que llegan de Telnet
Then what fails me is that in the program I get an exception in the son thread, I keep the exception in a log and it says "sub-process aborted"
And I do not know how to solve it.