Cakewalk.World.TCP_SocketConnected C# (CSharp) Метод

TCP_SocketConnected() приватный Метод

Event handler for TCP connections.
private TCP_SocketConnected ( Socket socket ) : void
socket Socket
Результат void
        private void TCP_SocketConnected(Socket socket)
        {
            //Keep going until we find an ID for them
            while (true)
            {
                //Generate an ID
                int worldID = m_rng.Next();

                //See if it's unique
                if (!m_entities.ContainsKey(worldID))
                {
                    //Add them in
                    ServerEntity entity = new ServerEntity(socket, worldID, this, m_asyncPool);
                    if (m_entities.TryAdd(worldID, entity))
                    {
                        //DONE!
                        Console.WriteLine(worldID.ToString() + " joined");
                        break;
                    }
                }
            }
        }