private void OnAcceptNewClient(IAsyncResult result) { TcpClient client = m_ServerListener.EndAcceptTcpClient(result); client.NoDelay = false; m_ServerListener.BeginAcceptTcpClient(OnAcceptNewClient, null); for (int i = 1; i < BaseInformationReader.Max_Players; i++) { if (GameClients[i].Client_Socket == null) { GameClients[i].Client_Socket = client; GameClients[i].Client_Token = i; GameClients[i].Client_IpAdress = client.Client.RemoteEndPoint.ToString(); GameClients[i].InitiliazeClient(m_NetworkReceiver); m_UnityServer.AppendNewLog("A new player has joined! With Client-ID: " + i + " From: " + GameClients[i].Client_IpAdress); m_UnityServer.AppendNewPlayer(true); ByteBuffer byteBuffer = new ByteBuffer(); byteBuffer.WriteInteger(999); // 999 package byteBuffer.WriteInteger(i); NetworkSend.SendTo(i, byteBuffer.ToArray()); return; } } }