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
파일 보기 프로젝트 열기: pstjuste/brunet 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
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