FindNextOpenClientSlot() 개인적인 정적인 메소드

private static FindNextOpenClientSlot ( ) : int
리턴 int
예제 #1
0
        private static void OnConnectionAccepted(ISocket client)
        {
            int num = Netplay.FindNextOpenClientSlot();

            if (num != -1)
            {
                Netplay.Clients[num].Socket = client;
                Netplay.Clients[num].sendQueue.StartThread();

                Console.WriteLine(client.GetRemoteAddress() + " is connecting to slot {0}...", num);
            }
            else
            {
                using (var stream = new MemoryStream())
                {
                    using (var writer = new BinaryWriter(stream))
                    {
                        writer.Write((short)0);
                        writer.Write((byte)2);
                        writer.Write("Server is full.");
                        short position = (short)writer.BaseStream.Position;
                        writer.BaseStream.Position = 0L;
                        writer.Write((short)position);
                        byte[] data = stream.ToArray();
                        client.AsyncSend(data, 0, data.Length, delegate { });
                    }
                }
                client.Close();
            }
        }
예제 #2
0
        private static void OnConnectionAccepted(ISocket client)
        {
            int nextOpenClientSlot = Netplay.FindNextOpenClientSlot();

            if (nextOpenClientSlot != -1)
            {
                Netplay.Clients[nextOpenClientSlot].Socket = client;
                Console.WriteLine((string)(object)client.GetRemoteAddress() + (object)" is connecting...");
            }
            if (Netplay.FindNextOpenClientSlot() != -1)
            {
                return;
            }
            Netplay.StopListening();
        }
예제 #3
0
파일: Netplay.cs 프로젝트: windlex/mylualib
        // Token: 0x06000159 RID: 345 RVA: 0x0002AA6C File Offset: 0x00028C6C
        private static void OnConnectionAccepted(ISocket client)
        {
            int num = Netplay.FindNextOpenClientSlot();

            if (num != -1)
            {
                Netplay.Clients[num].Reset();
                Netplay.Clients[num].Socket = client;
                Console.WriteLine(Language.GetTextValue("Net.ClientConnecting", client.GetRemoteAddress()));
            }
            if (Netplay.FindNextOpenClientSlot() == -1)
            {
                Netplay.StopListening();
            }
        }
예제 #4
0
        private static void OnConnectionAccepted(ISocket client)
        {
            int num = Netplay.FindNextOpenClientSlot();

            if (num != -1)
            {
                Netplay.Clients[num].Reset();
                Netplay.Clients[num].Socket = client;
                Console.WriteLine(client.GetRemoteAddress() + " is connecting...");
            }
            if (Netplay.FindNextOpenClientSlot() == -1)
            {
                Netplay.StopListening();
            }
        }
예제 #5
0
        private static void OnConnectionAccepted(ISocket client)
        {
            var nextOpenClientSlot = Netplay.FindNextOpenClientSlot();

            if (nextOpenClientSlot != -1)
            {
                Netplay.Clients[nextOpenClientSlot].Reset();
                Netplay.Clients[nextOpenClientSlot].Socket = client;
                Console.WriteLine(Language.GetTextValue("Net.ClientConnecting", (object)client.GetRemoteAddress()));
            }

            if (Netplay.FindNextOpenClientSlot() != -1)
            {
                return;
            }
            Netplay.StopListening();
        }
예제 #6
0
파일: Netplay.cs 프로젝트: Neubulae/Sources
        private static void OnConnectionAccepted(ISocket client)
        {
            int nextOpenClientSlot = Netplay.FindNextOpenClientSlot();

            if (nextOpenClientSlot != -1)
            {
                Netplay.Clients[nextOpenClientSlot].Reset();
                Netplay.Clients[nextOpenClientSlot].Socket = client;
            }
            else
            {
                lock (Netplay.fullBuffer)
                    Netplay.KickClient(client, NetworkText.FromKey("CLI.ServerIsFull"));
            }
            if (Netplay.FindNextOpenClientSlot() != -1)
            {
                return;
            }
            Netplay.StopListening();
            Netplay.IsListening = false;
        }