Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Start a new server
            SwarmServer swarmserver = new SwarmServer();

            swarmserver.startServer();
        }
Exemplo n.º 2
0
        public void startClient(TcpClient inClientSocket, int clientId, SwarmServer swarmServer)
        {
            this.clientSocket = inClientSocket;
            this.clientId     = clientId;
            this.swarmServer  = swarmServer;
            IPAddress ipAddress = ((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address;

            ipRemoteEndPointReceive = new IPEndPoint(ipAddress, 0);
            ipRemoteEndPointSend    = new IPEndPoint(ipAddress, swarmServer.port + 2);


            X = rand.NextDouble();
            Y = 1.5;
            Z = rand.NextDouble() - 1;
            swarmServer.xPlayers.Add(X);
            swarmServer.yPlayers.Add(Y);
            swarmServer.zPlayers.Add(Z);
            swarmServer.rxPlayers.Add(0);
            swarmServer.ryPlayers.Add(0);
            swarmServer.rzPlayers.Add(0);
            swarmServer.playerLap.Add(true);
            swarmServer.updateTime.Add(0);
            swarmServer.listScore.Add(0);
            register();
        }