public MainWindow() { InitializeComponent(); Task.Run(() => { PeerServer pserver = new PeerServer(); pserver.Start(); }); }
public override void Initialize() { Log("Initializing Client"); svr = new IntergratedServer(); Core.Svr = svr; svr.Initialize(); ps = new PeerServer() { client = this }; ps.Initialize(); }
internal DataXceiverServer(PeerServer peerServer, Configuration conf, DataNode datanode ) { this.peerServer = peerServer; this.datanode = datanode; this.maxXceiverCount = conf.GetInt(DFSConfigKeys.DfsDatanodeMaxReceiverThreadsKey , DFSConfigKeys.DfsDatanodeMaxReceiverThreadsDefault); this.estimateBlockSize = conf.GetLongBytes(DFSConfigKeys.DfsBlockSizeKey, DFSConfigKeys .DfsBlockSizeDefault); //set up parameter for cluster balancing this.balanceThrottler = new DataXceiverServer.BlockBalanceThrottler(conf.GetLong( DFSConfigKeys.DfsDatanodeBalanceBandwidthpersecKey, DFSConfigKeys.DfsDatanodeBalanceBandwidthpersecDefault ), conf.GetInt(DFSConfigKeys.DfsDatanodeBalanceMaxNumConcurrentMovesKey, DFSConfigKeys .DfsDatanodeBalanceMaxNumConcurrentMovesDefault)); }
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); } }
public PeerManager(Core core, ILoggable log = null) { Log = log ?? new NullLogger(); Core = core; if (!File.Exists(peersPath)) { File.Create(peersPath).Dispose(); } Log.NewLine($"Creating UPnP port mapping."); CreateUPnPMapping(); Log.NewLine("Setting up server and accepting connections..."); // Take some unique random ips from all the saved peers to connect to initially. string[] ips = File.ReadAllLines(peersPath) .Distinct() .ToArray() .Shuffle() .Take(Config.MaximumConnections) .ToArray(); foreach (string ip in ips) { AddPeer(ip); } PeerInterval = new Timer(Config.PeerInterval); PeerInterval.Elapsed += PeerInterval_Elapsed; PeerInterval.AutoReset = true; PeerInterval.Enabled = true; KeepAliveInterval = new Timer(Config.PeerKeepAliveInterval); KeepAliveInterval.Elapsed += KeepAliveInterval_Elapsed; KeepAliveInterval.AutoReset = true; KeepAliveInterval.Enabled = true; // Final step: initiate the server _ = new PeerServer(Config.TcpPort); }