Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            Task.Run(() =>
            {
                PeerServer pserver = new PeerServer();
                pserver.Start();
            });
        }
Ejemplo n.º 2
0
        public void Start()
        {
            Task.Run(() =>
            {
                PeerServer pserver = new PeerServer();
                pserver.Start();
            });

            PeerClient pclient = new PeerClient();

            Console.WriteLine("Skriv ønskede fil");
            String fileName           = Console.ReadLine();
            List <FileEndPoint> files = pclient.Search(fileName);

            if (files.Count > 0)
            {
                // take the first
                pclient.Download(fileName, files[0], fileName);
            }
        }