C# Class Brunet.Applications.Examples.HelloWorldNodeDataHandler

This class show an example HelloWorld of Brunet using IDataHandler. We inherit BasicNode and IDataHandler. BasicNode provides access to Brunet in a clean manner and IDataHandler allows this class to be an end point for p2p communication.
Inheritance: Brunet.Applications.BasicNode, IDataHandler
Datei anzeigen Open project: pstjuste/brunet Class Usage Examples

Public Properties

Property Type Description
HW PType

Public Methods

Method Description
HandleData ( MemBlock payload, ISender return_path, object state ) : void

This is the only method declared by IDataHandler. All packets that are of PType("HelloWorld") will arrive here.

HelloWorldNodeDataHandler ( NodeConfig node_config ) : Brunet

The only parameter to the constructor is a valid NodeConfig. We also register the PType here.

Main ( string args ) : int
Run ( ) : void

This is the work horse method.

SendMessage ( Brunet.Address remote_addr, ICopyable data ) : void

This methods send some ICopyable data to the remote address.

Method Details

HandleData() public method

This is the only method declared by IDataHandler. All packets that are of PType("HelloWorld") will arrive here.
public HandleData ( MemBlock payload, ISender return_path, object state ) : void
payload MemBlock
return_path ISender
state object
return void

HelloWorldNodeDataHandler() public method

The only parameter to the constructor is a valid NodeConfig. We also register the PType here.
public HelloWorldNodeDataHandler ( NodeConfig node_config ) : Brunet
node_config Brunet.Applications.NodeConfig
return Brunet

Main() public static method

public static Main ( string args ) : int
args string
return int

Run() public method

This is the work horse method.
public Run ( ) : void
return void

SendMessage() public method

This methods send some ICopyable data to the remote address.
public SendMessage ( Brunet.Address remote_addr, ICopyable data ) : void
remote_addr Brunet.Address Remote Nodes are referenced by their P2P /// Address, typically of type AHAddress.
data ICopyable This is an ICopyable object which contains the data /// to send.
return void

Property Details

HW public_oe property

A PType, or packet type, allows us to specify a type of packet that we would like to receive from the underlying Brunet Node. This is prepended to all outgoing packets and is removed on all incoming packets prior to their arrival at HandleData.
public PType HW
return PType