Ejemplo n.º 1
0
        private void ShowInThread()
        {
            ToolSocket tSocket = TSocket;

            tSocket.AutoStart();
            Socket socket;

            while ((socket = tSocket.Accept()) != null && tc)
            {
                string    text    = tSocket.Read(1024, socket);
                string[]  array   = text.Split('|');
                IPAddress address = ((IPEndPoint)socket.RemoteEndPoint).Address;
                if (array.Length > 0 && array[0] == SecretCode && array[1] == NewConnect)
                {
                    if (!ListUsersConnections.Contains(socket))
                    {
                        ListUsersConnections.Add(socket);
                        addNewUser(listView1, address.ToString(), new string[6]
                        {
                            array[2],
                            array[3],
                            array[4],
                            array[5],
                            array[6],
                            "0 KB / 0 KB "
                        });
                    }
                }
                else
                {
                    socket.Disconnect(reuseSocket: false);
                }
            }
        }