C# Класс 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.
Наследование: Brunet.Applications.BasicNode, IDataHandler
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
HW PType

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

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

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

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

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

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

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

Main() публичный статический Метод

public static Main ( string args ) : int
args string
Результат int

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

This is the work horse method.
public Run ( ) : void
Результат void

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

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

Описание свойств

HW публичное свойство

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