C# Class Kademlia.Dht

This is the class you use to use the library. You can put and get values. It is responsible for bootstraping the local node and connecting to the appropriate overlay. It also registers us with the overlay.
Mostra file Open project: zencoders/sambatyon Class Usage Examples

Public Methods

Method Description
Dht ( KademliaNode dhtNode = null, bool alreadyBootstrapped = false, string btpNode = "" ) : System

Create a DHT using the given master server, and specify whether to publish our IP. PRECONDITION: Create one per app or you will have a node ID collision.

Get ( string key ) : KademliaResource

Retrieve a value from the DHT.

GetAll ( string key ) : IList

Retrieve all applicable values from the DHT.

MaxSize ( ) : int

Returns the maximum size of individual puts.

Put ( string filename ) : void

Puts a value in the DHT under a key.

Method Details

Dht() public method

Create a DHT using the given master server, and specify whether to publish our IP. PRECONDITION: Create one per app or you will have a node ID collision.
public Dht ( KademliaNode dhtNode = null, bool alreadyBootstrapped = false, string btpNode = "" ) : System
dhtNode KademliaNode The KademliaNode that is used to communicate using the protocol
alreadyBootstrapped bool Checks if the node have or not to bootstrap
btpNode string The node to bootstrap with (can be leaved null)
return System

Get() public method

Retrieve a value from the DHT.
public Get ( string key ) : KademliaResource
key string The key of the value to retrieve.
return Persistence.KademliaResource

GetAll() public method

Retrieve all applicable values from the DHT.
public GetAll ( string key ) : IList
key string The key of the value to retrieve.
return IList

MaxSize() public method

Returns the maximum size of individual puts.
public MaxSize ( ) : int
return int

Put() public method

Puts a value in the DHT under a key.
public Put ( string filename ) : void
filename string The filename of resource to store into the network
return void