Table of Contents

Class StreamWrapper

Namespace
Sportradar.LiveData.Sdk.Common.Utils
Assembly
Sportradar.LiveData.Sdk.dll

Another workaround for a .NET bug (http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/f4c3d019-aecd-4fc6-9dea-680f04faa900)

NetworkStream

  • non-blocking Read() returns 0 bytes when there is nothing to read
  • IOException when "the underlying Socket is closed." -> reconnect
  • Write() is thread-safe

SslStream

  • >non-blocking Read() throws IOException -> no need to reconnect
  • after the exception a subsequent non-blocking Read() (when there is nothing to read) returns 5 bytes of SSL keep-alive data (23 3 1 0 17) 23 is TLS application protocol, 3 1 means TLS 1.0, 3 0 would be SSL 3.0
  • Write() is NOT thread-safe

Unify the behavior to NetworkStream behavior.

public class StreamWrapper
Inheritance
StreamWrapper
Inherited Members

Remarks

This implementation of stream wrapper is not thread safe.

Properties

ReadTimeout

public int ReadTimeout { get; set; }

Property Value

int

Stream

public Stream Stream { set; }

Property Value

Stream

TcpClient

public TcpClient TcpClient { get; set; }

Property Value

TcpClient

WriteTimeout

public int WriteTimeout { get; set; }

Property Value

int

Methods

Close()

public void Close()

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Flush()

public void Flush()

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Read(byte[], int, int)

public int Read(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int

Returns

int

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Write(byte[], int, int)

public void Write(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int