C# 클래스 BitSharper.NetworkConnection

A NetworkConnection handles talking to a remote BitCoin peer at a low level. It understands how to read and write messages off the network, but doesn't asynchronously communicate with the peer or handle the higher level details of the protocol. After constructing a NetworkConnection, use a Peer to hand off communication to a background thread.
Construction is blocking whilst the protocol version is negotiated.
상속: IDisposable
파일 보기 프로젝트 열기: TangibleCryptography/BitSharper

공개 메소드들

메소드 설명
Dispose ( ) : void
NetworkConnection ( ) : System
NetworkConnection ( IPAddress inetAddress, NetworkParameters @params, uint bestHeight, int connectTimeout ) : System
NetworkConnection ( PeerAddress peerAddress, NetworkParameters @params, uint bestHeight, int connectTimeout ) : System

Connect to the given IP address using the port specified as part of the network parameters. Once construction is complete a functioning network channel is set up and running.

Ping ( ) : void

Sends a "ping" message to the remote node. The protocol doesn't presently use this feature much.

ReadMessage ( ) : Message

Reads a network message from the wire, blocking until the message is fully received.

Shutdown ( ) : void

Shuts down the network socket. Note that there's no way to wait for a socket to be fully flushed out to the wire, so if you call this immediately after sending a message it might not get sent.

ToString ( ) : string
WriteMessage ( Message message ) : void

Writes the given message out over the network using the protocol tag. For a Transaction this should be "tx" for example. It's safe to call this from multiple threads simultaneously, the actual writing will be serialized.

메소드 상세

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

NetworkConnection() 공개 메소드

public NetworkConnection ( ) : System
리턴 System

NetworkConnection() 공개 메소드

public NetworkConnection ( IPAddress inetAddress, NetworkParameters @params, uint bestHeight, int connectTimeout ) : System
inetAddress System.Net.IPAddress
@params NetworkParameters
bestHeight uint
connectTimeout int
리턴 System

NetworkConnection() 공개 메소드

Connect to the given IP address using the port specified as part of the network parameters. Once construction is complete a functioning network channel is set up and running.
If there is a network related failure. If the version negotiation failed.
public NetworkConnection ( PeerAddress peerAddress, NetworkParameters @params, uint bestHeight, int connectTimeout ) : System
peerAddress PeerAddress IP address to connect to. IPv6 is not currently supported by BitCoin. If port is not positive the default port from params is used.
@params NetworkParameters
bestHeight uint How many blocks are in our best chain
connectTimeout int Timeout in milliseconds when initially connecting to peer
리턴 System

Ping() 공개 메소드

Sends a "ping" message to the remote node. The protocol doesn't presently use this feature much.
public Ping ( ) : void
리턴 void

ReadMessage() 공개 메소드

Reads a network message from the wire, blocking until the message is fully received.
If the message is badly formatted, failed checksum or there was a TCP failure.
public ReadMessage ( ) : Message
리턴 Message

Shutdown() 공개 메소드

Shuts down the network socket. Note that there's no way to wait for a socket to be fully flushed out to the wire, so if you call this immediately after sending a message it might not get sent.
public Shutdown ( ) : void
리턴 void

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

WriteMessage() 공개 메소드

Writes the given message out over the network using the protocol tag. For a Transaction this should be "tx" for example. It's safe to call this from multiple threads simultaneously, the actual writing will be serialized.
public WriteMessage ( Message message ) : void
message Message
리턴 void