C# Class PeerLibrary.Peer

Inheritance: IDisposable, IPeer
Afficher le fichier Open project: zencoders/sambatyon Class Usage Examples

Méthodes publiques

Méthode Description
Configure ( string udpPort = "-1", string kademliaPort = "-1" ) : void

PeerLibrary.IPeer

ConnectToStream ( ) : Stream

PeerLibrary.IPeer

Dispose ( ) : void

Method created to implement the IDisposable interface and used to close all service hosts already running.

GetAllTracks ( ) : IList

Method used to get all stored tracks

GetFlow ( string RID, int begin, long length, float>.Dictionary nodes ) : void

PeerLibrary.IPeer

GetFlow ( string RID, int begin, long length, float>.Dictionary nodes, Stream stream = null ) : void

Overload of the previous method with an extern stream passed.

Peer ( bool single = false, string btpNode = "" ) : System

Peer Constructor. It initialize configuration according to the options passed, initialize the local stream, creates the databases and resolves the IP address using Dns class.

RestartFlow ( ) : void

PeerLibrary.IPeer

RunLayers ( bool withoutInterface = false ) : void

Method used to run layers (kademlia, transport, interface). Each layer is ran in a separate thread in order to allow to register the thread hosting the service with a referrer thread id (in global threadpool) that is different from the mai thread. The method will wait each layer to have completely finished booting before passing to another layer.

SearchFor ( string queryString ) : IList

PeerLibrary.IPeer

StopFlow ( ) : void

PeerLibrary.IPeer

StoreFile ( string filename ) : bool

PeerLibrary.IPeer

Private Methods

Méthode Description
calculateAddresses ( ) : void

Method used to construct all local addresses according to configuration.

runInterfaceLayer ( System.ServiceModel.ServiceHost &svcHost ) : void

Method (usually runned like a thread) that privately hosts the interface service.

runKademliaLayer ( bool single, string btpNode, System.ServiceModel.ServiceHost &svcHost ) : void

Method that runs the kademlia layer

runTransportLayer ( System.ServiceModel.ServiceHost &svcHost ) : void

Method that runs the transport layer

Method Details

Configure() public méthode

PeerLibrary.IPeer
public Configure ( string udpPort = "-1", string kademliaPort = "-1" ) : void
udpPort string String containing the value of the udpPort
kademliaPort string String containig the value of the kademliaPort
Résultat void

ConnectToStream() public méthode

PeerLibrary.IPeer
public ConnectToStream ( ) : Stream
Résultat Stream

Dispose() public méthode

Method created to implement the IDisposable interface and used to close all service hosts already running.
public Dispose ( ) : void
Résultat void

GetAllTracks() public méthode

Method used to get all stored tracks
public GetAllTracks ( ) : IList
Résultat IList

GetFlow() public méthode

PeerLibrary.IPeer
public GetFlow ( string RID, int begin, long length, float>.Dictionary nodes ) : void
RID string The resource identifier
begin int The begin point from the head of a file to start download
length long The total length of file
nodes float>.Dictionary Nodes with associated score that are used to download a file from the network
Résultat void

GetFlow() public méthode

Overload of the previous method with an extern stream passed.
public GetFlow ( string RID, int begin, long length, float>.Dictionary nodes, Stream stream = null ) : void
RID string The resource identifier
begin int The begin point from the head of a file to start download
length long The total length of file
nodes float>.Dictionary Nodes with associated score that are used to download a file from the network
stream Stream The stream to use
Résultat void

Peer() public méthode

Peer Constructor. It initialize configuration according to the options passed, initialize the local stream, creates the databases and resolves the IP address using Dns class.
public Peer ( bool single = false, string btpNode = "" ) : System
single bool Indicates if the peer have to run kademlia layer in single bootstrap
btpNode string Address of the suggested bootstrap node.
Résultat System

RestartFlow() public méthode

PeerLibrary.IPeer
public RestartFlow ( ) : void
Résultat void

RunLayers() public méthode

Method used to run layers (kademlia, transport, interface). Each layer is ran in a separate thread in order to allow to register the thread hosting the service with a referrer thread id (in global threadpool) that is different from the mai thread. The method will wait each layer to have completely finished booting before passing to another layer.
public RunLayers ( bool withoutInterface = false ) : void
withoutInterface bool indicates whether to start or not the peer interface layer.
Résultat void

SearchFor() public méthode

PeerLibrary.IPeer
public SearchFor ( string queryString ) : IList
queryString string the querystring used to search
Résultat IList

StopFlow() public méthode

PeerLibrary.IPeer
public StopFlow ( ) : void
Résultat void

StoreFile() public méthode

PeerLibrary.IPeer
public StoreFile ( string filename ) : bool
filename string filename of the file to download
Résultat bool