Beispiel #1
0
        static void Main(string[] args)
        {
            //grab the port and address from the command line or set it to default
            listenPort = args.Count() >= 1 ? int.Parse(args[0]) : 70;
            listenAddress = args.Count() >= 2 ? args[2].Trim() : Dns.GetHostName();
            List<Thread> threadPool = new List<Thread>();
            foreach (IPAddress ip in Dns.GetHostEntry(listenAddress).AddressList.Where( (IPAddress p) => ipMatchesSettings(p) ) )
            {

                Server server = new Server(new IPEndPoint(ip,listenPort));
                ServerDecorator(ref server);
                var bgt = new Thread(server.Start);
                bgt.Start();
                //server.Start();
            }

            Console.ReadLine();

            //ThreadedServer ts = new ThreadedServer(listen); ts.Start(); Console.ReadLine();
        }
Beispiel #2
0
 private static void ServerDecorator(ref Server server)
 {
     server.OnServerNotify += server_OnServerNotify;
     server.OnProtocolNotify += (object sender, ConnectionEventArgs e) => Console.WriteLine(sender.ToString() + e.Message);
     server.OnServerNotify += (object sender, ConnectionEventArgs e) => Console.WriteLine(sender.ToString() + e.Message);
 }