示例#1
0
        public void RunCycle(float DeltaTime)
        {
            foreach (PeerConnection item in _PendingConnections.ToArray())
            {
                item.RunCycle(DeltaTime);

                // Clean up the connections that finished being rejected or was lost.
                if (item.ConnectionStatus == 0)
                {
                    _PendingConnections.Remove(item);
                    item.Dispose();
                }
            }
            if (_Active)
            {
                while (_Listener.Pending())
                {
                    PeerConnection NewConnection = PeerConnection.AcceptConnectionFromTcpListener(LocalIdentity, _Listener);
                    NewConnection.AutoSendGreeting = false; // Specifically for enabling user request scrutiny.
                    _PendingConnections.Add(NewConnection);
                }
            }
        }
示例#2
0
        public void RunCycle(float DeltaTime)
        {
            if (_Active)
            {
                while (_ListenerSocket.Pending())
                {
                    PeerConnection NewConnection = PeerConnection.AcceptConnectionFromTcpListener("Some Guy's Server", _ListenerSocket);
                    ClientInfo     NewClient     = new ClientInfo(this, NewConnection, _NextGuestId);
                    _Clients.Add(NewClient);
                    Log_Write_System(string.Format("A new guest has connected! It was assigned an ID of {0}.", _NextGuestId));

                    _NextGuestId++;
                }
            }
            foreach (ClientInfo item in _Clients.ToArray())
            {
                item.C.RunCycle(DeltaTime);
                foreach (string m in item.C.Log_CollectOutput())
                {
                    Log_Write(m);
                }
            }
            CheckOnClients();
        }