WoWClassic.Gateway.GatewayServer.Listen C# (CSharp) Method

Listen() public method

public Listen ( IPEndPoint endPoint ) : void
endPoint System.Net.IPEndPoint
return void
        public override void Listen(IPEndPoint endPoint)
        {
            base.Listen(endPoint);

            // Initialize WorldGatewayServer, so world servers can connect
            WorldGatewayServer = new WorldGatewayServer();
            WorldGatewayServer.Listen(new IPEndPoint(IPAddress.Any, 8090));

            // Announce the realm (triggering world servers to connect)
            Service.Participate();
            // TODO: Load realm from database / config
            Service.RealmState = new RealmState
            {
                ID = 1,
                Realm = new Realm()
                {
                    Type = RealmType.Normal,
                    Flags = RealmFlags.None,
                    Name = "Test Server",
                    Address = "127.0.0.1:8085",
                    Population = RealmPopulationPreset.Low,
                    Characters = 0,
                    Timezone = RealmTimezone.AnyLocale,
                },
                Status = RealmStatus.Online,
                GatewayPort = 8090
            };
        }

Usage Example

コード例 #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();
        }
All Usage Examples Of WoWClassic.Gateway.GatewayServer::Listen