Esempio n. 1
0
        public Client(Server s, TcpClient c)
        {
            _tcpClient = c;
            _server = s;
            (new Thread(new ThreadStart(SetupConnection))).Start();
               // (new Thread(new ThreadStart(UpdateReceiver))).Start();

            _udpClient = new UdpClient(new IPEndPoint(IPAddress.Any, 42556));
        }
Esempio n. 2
0
        public Session(bool isHost, string playerName)
        {
            IsActive = true;
            Console.WriteLine("New session started. Is host? {0}, Player Name: {1}", isHost, playerName);
            this._playerName = playerName;
            IsHost = isHost;

            if (isHost)
            {
                //Server automatically starts listening for players.
                _server = new Server();

                //Automatically connects to own server.
                //ConnectTo("192.168.1.1", 42555);
            }
            else
            {
                ConnectTo("127.0.0.1", 42555);
            }
        }