示例#1
0
        public Server(IPAddress ip, int port)
        {
            console = new consoleUI();

            int maxPlayers = 3;

            player = new Client[maxPlayers];
            reservedIDs = new Boolean[maxPlayers];

            for (int i = 0; i < reservedIDs.Length; i++)
            {
                reservedIDs[i] = false;
            }

            try
            {
                tcpListener = new TcpListener(IPAddress.Any, port);
                tcpListener.Start();
            }
            catch (Exception exp)
            {
                console.consoleW("Beim Versuch der Auflösung der Addresse: " + ip.ToString() + " enstand folgender Fehler:\r\n" + exp.Message, "error");
                while (true) ;
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.Title = "Flucky Server 1.0";

            consoleUI console = new consoleUI();

            console.consoleW("Firin' up the server!", "info");
            console.consoleW("Connecting to MySql (root@localhost)...", "progress");

            IPAddress ipAdresse = IPAddress.Any;

            Server server = new Server(ipAdresse, 23);

            Database myDatabase = new Database(server);
            string dbStatus = myDatabase.connect("localhost", "game", "", "game");
            if (dbStatus != "ok")
            {
                console.consoleW("MySql Error: " + dbStatus, "error");
                while (true) ;
            }

            console.consoleW("Successfully connected to MySql!", "success");

            Thread tcpHandlerThread = new Thread(server.wait);
            tcpHandlerThread.Start();

            consoleHandler consoleHandler = new Flucky_Server.consoleHandler(server);
            Thread consoleHandlerThread = new Thread(consoleHandler.start);
            consoleHandlerThread.Start();

            console.consoleW("Finished!", "success");

            while (true) ;
        }
示例#3
0
 public Client(Server _server, Socket getSocket, int id)
 {
     server = _server;
     socket = getSocket;
     console = new consoleUI();
     ClientID = id;
     UTF8Encoding encoding = new UTF8Encoding();
     socket.Send(encoding.GetBytes("Sie sind nun in guten Hands!"));
 }
示例#4
0
 public consoleHandler(Server _server)
 {
     console = new consoleUI();
     server = _server;
 }