C# Class Squishy.Network.ConnectionWriter

The ConnectionWriter provides several methods to send continuous data from a Stream. When either the Connection disconnects, reading fails or no more data can be read, the stream will be closed after the corresponding event has been raised if CloseStreamAfterTranscaction is set to true - otherwise left open.
Afficher le fichier Open project: jaddie/WCell-Utility-Bot

Méthodes publiques

Свойство Type Description
CloseStreamAfterTransaction bool

Méthodes publiques

Méthode Description
ConnectionWriter ( ) : System
ConnectionWriter ( Connection con ) : System
Stop ( ) : void

Stops reading and -if CloseStreamAfterTransaction is true- also closes the underlying stream.

WriteAll ( Stream stream ) : void

If not writing yet, asynchronously sends everything that can be read from this stream.

WriteFile ( FileInfo file ) : void

If not writing yet, opens a readonly-stream to the given file and will asynchronously send it to the remote connection.

Private Methods

Méthode Description
ContinueReadStreamData ( ) : void
DataReadFailedNotify ( Exception e ) : void
DataSentNotify ( ) : void
InitWrite ( Stream stream ) : void
OnInternalDisconnected ( Connection con, bool conLost ) : void
OnInternalSent ( Connection con, int amount, bool hasReamining ) : void
OnStreamRead ( IAsyncResult ar ) : void
ResetAfterTransfer ( ) : void

Method Details

ConnectionWriter() public méthode

public ConnectionWriter ( ) : System
Résultat System

ConnectionWriter() public méthode

public ConnectionWriter ( Connection con ) : System
con Connection
Résultat System

Stop() public méthode

Stops reading and -if CloseStreamAfterTransaction is true- also closes the underlying stream.
public Stop ( ) : void
Résultat void

WriteAll() public méthode

If not writing yet, asynchronously sends everything that can be read from this stream.
public WriteAll ( Stream stream ) : void
stream Stream
Résultat void

WriteFile() public méthode

If not writing yet, opens a readonly-stream to the given file and will asynchronously send it to the remote connection.
public WriteFile ( FileInfo file ) : void
file FileInfo
Résultat void

Property Details

CloseStreamAfterTransaction public_oe property

Indicates wether to close the Stream when failed or finished reading. Default: true
public bool CloseStreamAfterTransaction
Résultat bool