﻿using System;
using System.Net;

namespace a
{
    class Program
    {
        //Code is dirty, who cares, it's C#.

        static void Main(string[] args)
        {
            //IPHostEntry heserver = Dns.GetHostEntry(Dns.GetHostName());
            //foreach (IPAddress curAdd in heserver.AddressList)
            //{
            Server server = new Server(IPAddress.Loopback, 5000);
                server.Start();
                Console.WriteLine("Press q to exit");
                while (true)
                {
                    try
                    {

                        char c = (char)Console.ReadLine()[0];
                        if (c == 'q')
                        {
                            server.Stop();
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        //who cares ?
                    }
                }
            //}

        }

    }
}

﻿using System;
using System.Net;

namespace a
{
    class Program
    {
        //Code is dirty, who cares, it's C#.
        static void Main(string[] args)
        {
            Server server = new Server(IPAddress.Any, 5000);
            server.Start();
            Console.WriteLine("Press q to exit");


            while (true)
            {
                try
                {

                    if (Console.ReadKey().KeyChar == 'q')
                    {
                        server.Stop();
                        return;
                    }
                }
                catch (Exception)
                {
                    //who cares ?
                }
            }
        }

    }

}

Fix problems with launching and exiting the app
Fix problems with launching and exiting the app
