C# Класс PeerLibrary.Peer

Наследование: IDisposable, IPeer
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

Configure() публичный Метод

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
Результат void

ConnectToStream() публичный Метод

PeerLibrary.IPeer
public ConnectToStream ( ) : Stream
Результат Stream

Dispose() публичный Метод

Method created to implement the IDisposable interface and used to close all service hosts already running.
public Dispose ( ) : void
Результат void

GetAllTracks() публичный Метод

Method used to get all stored tracks
public GetAllTracks ( ) : IList
Результат IList

GetFlow() публичный Метод

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
Результат void

GetFlow() публичный Метод

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
Результат void

Peer() публичный Метод

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.
Результат System

RestartFlow() публичный Метод

PeerLibrary.IPeer
public RestartFlow ( ) : void
Результат void

RunLayers() публичный Метод

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.
Результат void

SearchFor() публичный Метод

PeerLibrary.IPeer
public SearchFor ( string queryString ) : IList
queryString string the querystring used to search
Результат IList

StopFlow() публичный Метод

PeerLibrary.IPeer
public StopFlow ( ) : void
Результат void

StoreFile() публичный Метод

PeerLibrary.IPeer
public StoreFile ( string filename ) : bool
filename string filename of the file to download
Результат bool