public void RunPeerServiceHost(Peer <IPingServices> peer) { if (peer == null) { throw new ArgumentNullException(nameof(peer)); } RegisterPeer.StartPeerRegistration(peer.PeerId, ConfigurePeer.port); if (RegisterPeer.IsPeerRegistered) { Console.WriteLine($"{peer.UserName} PeerResgistrationCompleted"); Console.WriteLine($"Peer Uri : {RegisterPeer.PeerUri} Port: {ConfigurePeer.port}"); } if (ResolvePeer != null) { Console.WriteLine($"Resolving peer {peer.UserName}"); ResolvePeer.ResolvePeerName(peer.PeerId); Console.WriteLine($"\t\t Endpoint for {RegisterPeer.PeerUri}"); if (ResolvePeer.PeerEndPointCollection.PeerEndPoint.Any()) { ResolvePeer.PeerEndPointCollection.PeerEndPoint.ToList().ForEach(p => Console.WriteLine($"IP : {p.Address}")); } ; } }
public void RunPeerServiceHost(Peer <IPingService> peer) { if (peer == null) { throw new ArgumentNullException(nameof(peer)); } RegisterPeer.StartPeerRegistration(peer.PeerID, _port); if (RegisterPeer.IsPeerRegistered) { Console.WriteLine($"{peer.Username} Registration Completed."); Console.WriteLine($"Peer Uri : {RegisterPeer.PeerUri} Port : {_port}"); } if (ResolvePeer != null) { Console.WriteLine($"Resolving Peer {peer.Username}.."); ResolvePeer.ResolvePeerName(peer.PeerID); var result = ResolvePeer.PeerEndpointCollection; if (ConfigurePeer.StartPeerService()) { Console.WriteLine($"Peer Services Started."); peer.Channel.Ping(new HostInfo { ID = peer.PeerID, Port = _port, Uri = RegisterPeer.PeerUri }); if (ConfigurePeer.PingService != null) { ConfigurePeer.PingService.PeerEndpointInformation += PingServiceOnPeerEndpointInformation; } Thread thd = new Thread(new ThreadStart(() => { if (StartFileShareService(_port, RegisterPeer.PeerUri)) { Console.WriteLine("File Service Host Started.."); var files = ConfigurePeer.PingService.AvailableFileMetaData; if (files.Any()) { Console.WriteLine($"\n Available Files {files.Count}"); } files.ToList().ForEach(fp => { Console.WriteLine($"Filename: {fp.FileName} Size: {fp.FileLength}"); }); } })); } else { Console.WriteLine($"Error Starting Peer Serivce."); } } }
public void RunPeerServiceHost(Peer <IPingService> peer) { if (peer == null) { throw new ArgumentNullException(nameof(peer)); } RegisterPeer.StartPeerRegistration(peer.PeerId, ConfigurePeer.Port); if (RegisterPeer.IsPeerRegistered) { Console.WriteLine($"{peer.UserName} Registration completed"); Console.WriteLine($"Peer Uri : {RegisterPeer.PeerUri} Port : {ConfigurePeer.Port}"); } if (ResolvePeer != null) { Console.WriteLine($"Resolving {peer.UserName}"); ResolvePeer.ResolvePeerName(peer.PeerId); var result = ResolvePeer.PeerEndPointCollection; Console.WriteLine($"\t\t EndPoints for {RegisterPeer.PeerUri}"); if (ConfigurePeer.StartPeerServices()) { Console.WriteLine("Peer services started"); if (ConfigurePeer.PingService != null) { ConfigurePeer.PingService.PeerEndPointInformation += PingServiceOnPeerEndPointInformation; } peer.Channel.Ping(new HostInfo { Id = peer.PeerId, Port = ConfigurePeer.Port, Uri = RegisterPeer.PeerUri }); } else { Console.WriteLine("error starting up peer services"); } } }