public void listen()
{
try
{
if (error != null)
throw new Exception( error );
listener = new TcpListener( port );
listener.Start();
OnStart( parent );
Console.WriteLine( "HTTP Server has started..." );
while (is_active)
{
TcpClient s = listener.AcceptTcpClient();
var processor = new HttpProcessor( s, this );
var thread = new Thread( processor.process );
thread.Start();
Thread.Sleep( 1 );
}
}
catch (Exception e)
{
if (!e.Message.Contains( "WSACancelBlockingCall" ))
{
Console.WriteLine( e.Message );
OnOnError( e.Message );
}
}
Console.WriteLine( "HTTP Server has stopped..." );
}