public void Stop()
{
try
{
Log.Debug("TVServerKodi: tcpListener.Stop()");
Console.WriteLine("TVServerKodi: tcpListener.Stop()");
stopme = true;
if (m_listenThread != null)
{
Log.Debug("TVServerKodi: Listenthread is aborting");
m_listenThread.Abort();
m_listenThread = null;
}
if (m_communicationThreads.Count > 0)
{
Log.Debug("TVServerKodi: Stop all communication threads");
foreach (Thread thread in m_communicationThreads)
{
thread.Abort();
}
m_communicationThreads.Clear();
m_communicationThreads = null;
}
if (m_clients.Count > 0)
{
Log.Debug("TVServerKodi: Closing all client connections");
foreach (TcpClient client in m_clients)
{
client.Close();
}
m_clients = null;
}
}
catch (Exception)
{ }
}