C# Класс 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.
Показать файл Открыть проект

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

Свойство Тип Описание
CloseStreamAfterTransaction bool

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

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

Приватные методы

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

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

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

public ConnectionWriter ( ) : System
Результат System

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

public ConnectionWriter ( Connection con ) : System
con Connection
Результат System

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

Stops reading and -if CloseStreamAfterTransaction is true- also closes the underlying stream.
public Stop ( ) : void
Результат void

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

If not writing yet, asynchronously sends everything that can be read from this stream.
public WriteAll ( Stream stream ) : void
stream Stream
Результат void

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

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

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

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

Indicates wether to close the Stream when failed or finished reading. Default: true
public bool CloseStreamAfterTransaction
Результат bool