void ListenForConnections()
{
listener = new TcpListener(System.Net.IPAddress.Any, Port);
try
{
listener.Start();
while (!abort)
{
TcpClient client = listener.AcceptTcpClient();
if (client != null)
{
StartClientConnection(client);
}
}
}
catch (ThreadAbortException)
{
}
catch (System.IO.IOException e)
{
RaiseExceptionEncountered(e, Guid.Empty);
}
catch (System.Net.Sockets.SocketException e)
{
RaiseExceptionEncountered(e, Guid.Empty);
}
catch (Exception e)
{
if (CrashOnException)
{
throw new PacketProcessingException(e);
}
else
{
RaiseExceptionEncountered(e, Guid.Empty);
}
}
}