Inheritance: WoWClassic.Common.Network.Server
コード例 #1
0
        private static void Main(string[] args)
        {
            Console.Title = "WoWGateway";

            for (var i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-ip":
                case "--ip":     // Defaults to IPAdress.Any (0.0.0.0)
                    string argIP = null;
                    if (!TryReadArg(args, ref i, out argIP) || !IPAddress.TryParse(argIP, out BindAddress))
                    {
                        Console.WriteLine("Unable to parse IP...");
                        Console.ReadKey();
                        return;
                    }
                    break;

                case "-p":
                case "--port":     // Defaults to 3724 (Retail)
                    string argPort = null;
                    if (!TryReadArg(args, ref i, out argPort) || !int.TryParse(argPort, out BindPort))
                    {
                        Console.WriteLine("Unable to parse port...");
                        Console.ReadKey();
                        return;
                    }
                    break;
                }
            }

            Log.CreateLogger <GatewayLogTypes>();

            Log.AddSubscriber(GatewayLogTypes.Packets, new FileLogSubscriber("Logs/GatewayPackets.txt"));
            Log.AddSubscriber(GatewayLogTypes.Packets, new ConsoleLogSubscriber("[PACKET] "));

            Log.AddSubscriber(GatewayLogTypes.DataStructure, new FileLogSubscriber("Logs/DataStructure.txt"));
            Log.AddSubscriber(GatewayLogTypes.DataStructure, new ConsoleLogSubscriber("[DATASTRUCT]"));

            // To make sure that the UDP multicast is received by the other servers
            if (System.Diagnostics.Debugger.IsAttached)
            {
                System.Threading.Thread.Sleep(500);
            }

            var srv = new GatewayServer();
            var ep  = new IPEndPoint(BindAddress, BindPort);

            srv.Listen(ep);
            Console.WriteLine("Server is now listening at {0}:{1}", ep.Address, ep.Port);

            Console.ReadKey();
        }
コード例 #2
0
        private static void Main(string[] args)
        {
            Console.Title = "WoWGateway";

            for (var i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                    case "-ip":
                    case "--ip": // Defaults to IPAdress.Any (0.0.0.0)
                        string argIP = null;
                        if (!TryReadArg(args, ref i, out argIP) || !IPAddress.TryParse(argIP, out BindAddress))
                        {
                            Console.WriteLine("Unable to parse IP...");
                            Console.ReadKey();
                            return;
                        }
                        break;

                    case "-p":
                    case "--port": // Defaults to 3724 (Retail)
                        string argPort = null;
                        if (!TryReadArg(args, ref i, out argPort) || !int.TryParse(argPort, out BindPort))
                        {
                            Console.WriteLine("Unable to parse port...");
                            Console.ReadKey();
                            return;
                        }
                        break;
                }
            }

            Log.CreateLogger<GatewayLogTypes>();

            Log.AddSubscriber(GatewayLogTypes.Packets, new FileLogSubscriber("Logs/GatewayPackets.txt"));
            Log.AddSubscriber(GatewayLogTypes.Packets, new ConsoleLogSubscriber("[PACKET] "));

            Log.AddSubscriber(GatewayLogTypes.DataStructure, new FileLogSubscriber("Logs/DataStructure.txt"));
            Log.AddSubscriber(GatewayLogTypes.DataStructure, new ConsoleLogSubscriber("[DATASTRUCT]"));

            // To make sure that the UDP multicast is received by the other servers
            if (System.Diagnostics.Debugger.IsAttached)
                System.Threading.Thread.Sleep(500);

            var srv = new GatewayServer();
            var ep = new IPEndPoint(BindAddress, BindPort);
            srv.Listen(ep);
            Console.WriteLine("Server is now listening at {0}:{1}", ep.Address, ep.Port);

            Console.ReadKey();
        }
コード例 #3
0
 public GatewayConnection(GatewayServer server, Socket socket)
     : base(server, socket)
 {
     GatewaySrv = server;
     HandleAcceptedConnection();
 }
コード例 #4
0
 public GatewayConnection(GatewayServer server, Socket socket)
     : base(server, socket)
 {
     GatewaySrv = server;
     HandleAcceptedConnection();
 }