public static void Connect(int port, string serverName, int timeOut)
        {
            Port       = port;
            ServerName = serverName;
            TimeOut    = timeOut;

            Console.WriteLine($"\n\t\tMainServerComms trying to connect:{Port}");
            InitIncomingPacketHandler();

            tCP = new TCP();
            tCP.Connect(LocalIP);

            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnEndingConsoleApplication);
        }
Beispiel #2
0
        public static void Connect(int port, string serverName, string mainServerIP)
        {
            Port       = port;
            ServerName = serverName;

            Output.WriteLine($"\n\t\tMainServerComms trying to connect:{Port}");
            InitIncomingPacketHandler();

            tCP = new TCP();
            tCP.Connect(mainServerIP);

            Application.quitting += OnApplicationQuiting;

            ServerSendDataTimer.Elapsed += SendServerDataToMainServer;
        }
        public Client(TcpClient _tcpSocket)
        {
            bool foundId = false;

            for (byte i = 0; i < maxPlayerCount; i++)
            {
                if (!allClients.ContainsKey(i))
                {
                    foundId = true;
                }
            }
            if (!foundId)
            {
                throw new Exception("Max client count exceeded");
            }

            tcp = new TCP(this);
            udp = new UDP(this);
            playerController = new PlayerController();
            tcp.Connect(_tcpSocket);
            allClients.Add(id, this);
        }
 public void TCPConnect(TcpClient _socket)
 {
     tcp.Connect(_socket);
     CreatePlayer();
 }