public byte[] GetIP(LoginClient client) { if (DefaultAddress == null) { string ip = "0.0.0.0"; if (thread != null) { ip = thread.wan; } DefaultAddress = new byte[4]; string[] w = ip.Split('.'); DefaultAddress[0] = byte.Parse(w[0]); DefaultAddress[1] = byte.Parse(w[1]); DefaultAddress[2] = byte.Parse(w[2]); DefaultAddress[3] = byte.Parse(w[3]); } if (thread != null) { byte[] redirect = NetworkRedirect.getInstance().GetRedirect(client, id); if (redirect != null) { return(redirect); } } return(DefaultAddress); }
public void Start() { Console.Title = "L2dotNET Loginserver"; Cfg.load(); ClientManager.Instance.Initialize(); ServerThreadPool.getInstance(); NetworkRedirect.getInstance(); LoginListener = new TcpListener(IPAddress.Parse(Cfg.SERVER_HOST), Cfg.SERVER_PORT); LoginListener.Start(); CLogger.extra_info("Auth server listening clients at " + Cfg.SERVER_HOST + ":" + Cfg.SERVER_PORT); new System.Threading.Thread(ServerThreadPool.getInstance().start).Start(); TcpClient clientSocket = default(TcpClient); while (true) { clientSocket = LoginListener.AcceptTcpClient(); AcceptClient(clientSocket); } }