[Help] 2 Login IPs for the same GameServer [5165]

06/17/2011 23:24 kingofdrift#1
Hello guys i make a server non-hamachi & people login with my internet ip adress so when i try to login i cant because i cant login to my self so i tried to make a second ip adress which is the hamachi one as i am going to login alone, the problem now that i made the coding for the second ip but it doesnt work the client says "Failed To Login To Game Server" here is the coding so please any one that can fix it release the fix and thank you for reading my post.

First open AuthWorker & search for
Code:
        static string GameIP;
Under that i wrote
Code:
        static.string HamachiIP;
Then search for
Code:
        public static void StartServer(string GameIP)
        {
            AuthWorker.GameIP = GameIP;
            try
            {
                Listener = new Connection();
                Listener.SetConnHandler(new ConnectionArrived(ConnectionHandler));
                Listener.SetDataHandler(new DataArrived(DataHandler));
                Listener.SetDCHandler(new Disconnection(DCHandler));
                Listener.Listen(9958);
            }
            catch (Exception Exc) { Program.WriteLine(Exc); }
        }
Under that i wrote
Code:
        public static void StartServer2(string LocalHost)
        {
            AuthWorker.LocalHost = GameIP;
            try
            {
                Listener = new Connection();
                Listener.SetConnHandler(new ConnectionArrived(ConnectionHandler));
                Listener.SetDataHandler(new DataArrived(DataHandler));
                Listener.SetDCHandler(new Disconnection(DCHandler));
                Listener.Listen(9959);
            }
            catch (Exception Exc) { Program.WriteLine(Exc); }
        }
Then search for
Code:
                            AC.Send(Packets.SendAuthentication(GameIP, IV));
And after that i wrote
Code:
                            AC.Send(Packets.SendAuthentication(LocalHost, IV));
now i am done in the AuthWorker

Now open GameWorker & search for
Code:
        public static void StartServer()
        {
            try
            {
                Listener = new Connection();
                Listener.SetConnHandler(new ConnectionArrived(ConnectionHandler));
                Listener.SetDataHandler(new DataArrived(DataHandler));
                Listener.SetDCHandler(new Disconnection(DCHandler));
                Listener.Listen(5816);
            }
            catch (Exception Exc) { Program.WriteLine(Exc); }
        }
Under that i wrote
Code:
        public static void StartServer2()
        {
            try
            {
                Listener = new Connection();
                Listener.SetConnHandler(new ConnectionArrived(ConnectionHandler));
                Listener.SetDataHandler(new DataArrived(DataHandler));
                Listener.SetDCHandler(new Disconnection(DCHandler));
                Listener.Listen(5817);
            }
            catch (Exception Exc) { Program.WriteLine(Exc); }
        }
And now we are also done in the GameWorker, Now go to Program.cs & Search for
Code:
                NewestCOServer.Main.AuthWorker.StartServer(I.ReadString("Database", "GameServerIP"));
Under that i wrote
Code:
                NewestCOServer.Main.AuthWorker.StartServer2(I.ReadString("Database", "GameServerIP2"));
And i wrote
Code:
                NewestCOServer.Main.GameWorker.StartServer2();
Now i was done then i openned OldCoDB then Config.ini and wrote under the "GameServerIP = My Internet IP" i wrote
"GameServerIP2 = My Hamachi IP"

now i was done in everything then i openned the server.dat and put my hamachi ip then i tried to login then the error appeared so if any one that can fix this problem plz post it and thank you xD
06/18/2011 10:03 zTek#2
127.0.0.1
06/19/2011 00:51 kingofdrift#3
i tried the 127.0.0.1 it doesnt work
06/20/2011 06:17 Sion~#4
This problem could be solved at the core, but if it's your wish to do it this way you can easily connect by simply calling the IPAddress.Any field, it's read only and provides an ip address that listens for client activity on all network interfaces. Provided that your method is listening on the official Authentication port (9959).. you're client should be connecting to your localhost at that port.

For other's to connect your external ip address, and your specified Authentication port(9958), is required.

Does you're client connect to the server at all? Breakpoint it out and let me know.
I state again.. this isn't the correct way to do this, but will it work. Yes.