C# Class IronSmarkets.Sockets.SafeSslStream

The purpose of this class is to wrap SslStream and provide thread-safe Read and Write blocking operations. The reason this is necessary is because NetworkStream is thread-safe for simultaneous reads and writes as long as there is a single reader and a single writer. SslStream, on the other hand, does not guarantee this safety. However, we can use BeginRead/BeginWrite to do asynchronous operations and simply signal to the main thread that they've completed. Performance will suffer slightly, but TLS network performance incurs its own buffering penalties by nature.
Inheritance: Stream
Afficher le fichier Open project: smarkets/IronSmarkets

Méthodes publiques

Méthode Description
Flush ( ) : void
Read ( byte buffer, int offset, int count ) : int
SafeSslStream ( SslStream stream ) : System
Seek ( long offset, SeekOrigin origin ) : long
SetLength ( long length ) : void
Write ( byte buffer, int offset, int count ) : void

Private Methods

Méthode Description
ReadCallback ( IAsyncResult ar ) : void
WriteCallback ( IAsyncResult ar ) : void

Method Details

Flush() public méthode

public Flush ( ) : void
Résultat void

Read() public méthode

public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
Résultat int

SafeSslStream() public méthode

public SafeSslStream ( SslStream stream ) : System
stream System.Net.Security.SslStream
Résultat System

Seek() public méthode

public Seek ( long offset, SeekOrigin origin ) : long
offset long
origin SeekOrigin
Résultat long

SetLength() public méthode

public SetLength ( long length ) : void
length long
Résultat void

Write() public méthode

public Write ( byte buffer, int offset, int count ) : void
buffer byte
offset int
count int
Résultat void