예제 #1
0
 public void Start(IPAddress IP, int Port)
 {
     try
     {
         if (ServerType == ServerTypeEnum.Login)
         {
             TcpLogin.Connect(IP, Port);
             OnClient = TcpLogin;
         }
         else if (ServerType == ServerTypeEnum.Game)
         {
             TcpGame.Connect(IP, Port);
             OnClient = TcpGame;
         }
         else if (ServerType == ServerTypeEnum.Message)
         {
             TcpMessenge.Connect(IP, Port);
             OnClient = TcpMessenge;
         }
         running = true;
         //Inicia Thread para escuta de OnClientes
         var WaitConnectionsThread = new Thread(new ThreadStart(HandleClient));
         WaitConnectionsThread.Start();
     }
     catch
     {
         WriteConsole.WriteLine("[BOT_EXCEPTION]: SERVER OFFLINE", ConsoleColor.Red);
         Console.ReadKey();
         Environment.Exit(0);
     }
 }
예제 #2
0
 public void Start()
 {
     try
     {
         TcpLogin.Connect(this.LoginServerIP, LoginServerPort);
         OnClient = TcpLogin;
         running  = true;
         //Inicia Thread para escuta de OnClientes
         var WaitConnectionsThread = new Thread(new ThreadStart(HandleClient));
         WaitConnectionsThread.Start();
     }
     catch
     {
         WriteConsole.WriteLine("[BOT_EXCEPTION]: SERVER OFFLINE", ConsoleColor.Red);
         Console.ReadKey();
         Environment.Exit(0);
     }
 }