C# Class Bauglir.Ex.WebSocketConnection

basic WebSocket connection
Show file Open project: gwupe/Gwupe Class Usage Examples

Protected Properties

Property Type Description
fClient System.Net.Sockets.TcpClient
fClosedByMe bool
fClosedByPeer bool
fCookie string
fExtension string
fFullDataProcess bool
fHandshake bool
fHeaders Bauglir.Ex.WebSocketHeaders
fHost string
fIndex int
fMasking bool
fOrigin string
fPort string
fProtocol string
fRequireMask bool
fResourceName string
fSsl bool
fSslStream System.Net.Security.SslStream
fVersion int

Public Methods

Method Description
Close ( int aCloseCode ) : void
Close ( int aCloseCode, string aCloseReason ) : void

close connection

Ping ( string aData ) : bool

send ping

Pong ( string aData ) : bool

send pong

SendBinary ( MemoryStream aStream ) : bool
SendBinary ( MemoryStream aStream, bool aWriteFinal ) : bool
SendBinary ( MemoryStream aStream, bool aWriteFinal, bool aRes1 ) : bool
SendBinary ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
SendBinary ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool

Send binary data

SendBinaryContinuation ( MemoryStream aStream ) : bool
SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal ) : bool
SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal, bool aRes1 ) : bool
SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool

send binary continuation data see SendBinary for parameter and result response

SendData ( bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3, int aWriteCode, MemoryStream aStream ) : bool
SendData ( bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3, int aWriteCode, String aData ) : bool
SendText ( String aString ) : bool
SendText ( String aString, bool aWriteFinal ) : bool
SendText ( String aString, bool aWriteFinal, bool aRes1 ) : bool
SendText ( String aString, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
SendText ( String aString, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool

Send textual data

SendTextContinuation ( String aString ) : bool
SendTextContinuation ( String aString, bool aWriteFinal ) : bool
SendTextContinuation ( String aString, bool aWriteFinal, bool aRes1 ) : bool
SendTextContinuation ( String aString, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
SendTextContinuation ( String aString, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool

Send textual continuation data

WebSocketConnection ( ) : System
WebSocketConnection ( TcpClient aClient ) : System

Protected Methods

Method Description
Close ( ) : void
Execute ( ) : void
ProcessClose ( int aCloseCode, string aCloseReason, bool aClosedByPeer ) : void
ProcessData ( bool &aReadFinal, bool &aRes1, bool &aRes2, bool &aRes3, int &aReadCode, MemoryStream aStream ) : void
ProcessPing ( string aData ) : void
ProcessPong ( string aData ) : void
ProcessStream ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, MemoryStream aStream ) : void
ProcessStreamContinuation ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, MemoryStream aStream ) : void
ProcessStreamFull ( MemoryStream aStream ) : void
ProcessText ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, string aString ) : void
ProcessTextContinuation ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, string aString ) : void
ProcessTextFull ( string aString ) : void
ReadByte ( Stream aStream, int &aByte ) : bool
ReadData ( bool &aReadFinal, bool &aRes1, bool &aRes2, bool &aRes3, int &aReadCode, MemoryStream aStream ) : bool
ReverseBytes ( byte inArray ) : byte[]
StartRead ( ) : void
getStream ( TcpClient aClient ) : Stream

Method Details

Close() protected method

protected Close ( ) : void
return void

Close() public method

public Close ( int aCloseCode ) : void
aCloseCode int
return void

Close() public method

close connection
public Close ( int aCloseCode, string aCloseReason ) : void
aCloseCode int WebSocketCloseCode constant reason
aCloseReason string textual data (max 123 bytes)
return void

Execute() protected method

protected Execute ( ) : void
return void

Ping() public method

send ping
public Ping ( string aData ) : bool
aData string string data
return bool

Pong() public method

send pong
public Pong ( string aData ) : bool
aData string string data
return bool

ProcessClose() protected method

protected ProcessClose ( int aCloseCode, string aCloseReason, bool aClosedByPeer ) : void
aCloseCode int
aCloseReason string
aClosedByPeer bool
return void

ProcessData() protected method

protected ProcessData ( bool &aReadFinal, bool &aRes1, bool &aRes2, bool &aRes3, int &aReadCode, MemoryStream aStream ) : void
aReadFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aReadCode int
aStream System.IO.MemoryStream
return void

ProcessPing() protected method

protected ProcessPing ( string aData ) : void
aData string
return void

ProcessPong() protected method

protected ProcessPong ( string aData ) : void
aData string
return void

ProcessStream() protected method

protected ProcessStream ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, MemoryStream aStream ) : void
aReadFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aStream System.IO.MemoryStream
return void

ProcessStreamContinuation() protected method

protected ProcessStreamContinuation ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, MemoryStream aStream ) : void
aReadFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aStream System.IO.MemoryStream
return void

ProcessStreamFull() protected method

protected ProcessStreamFull ( MemoryStream aStream ) : void
aStream System.IO.MemoryStream
return void

ProcessText() protected method

protected ProcessText ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, string aString ) : void
aReadFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aString string
return void

ProcessTextContinuation() protected method

protected ProcessTextContinuation ( bool aReadFinal, bool aRes1, bool aRes2, bool aRes3, string aString ) : void
aReadFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aString string
return void

ProcessTextFull() protected method

protected ProcessTextFull ( string aString ) : void
aString string
return void

ReadByte() protected method

protected ReadByte ( Stream aStream, int &aByte ) : bool
aStream Stream
aByte int
return bool

ReadData() protected method

protected ReadData ( bool &aReadFinal, bool &aRes1, bool &aRes2, bool &aRes3, int &aReadCode, MemoryStream aStream ) : bool
aReadFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aReadCode int
aStream System.IO.MemoryStream
return bool

ReverseBytes() protected static method

protected static ReverseBytes ( byte inArray ) : byte[]
inArray byte
return byte[]

SendBinary() public method

public SendBinary ( MemoryStream aStream ) : bool
aStream System.IO.MemoryStream
return bool

SendBinary() public method

public SendBinary ( MemoryStream aStream, bool aWriteFinal ) : bool
aStream System.IO.MemoryStream
aWriteFinal bool
return bool

SendBinary() public method

public SendBinary ( MemoryStream aStream, bool aWriteFinal, bool aRes1 ) : bool
aStream System.IO.MemoryStream
aWriteFinal bool
aRes1 bool
return bool

SendBinary() public method

public SendBinary ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
aStream System.IO.MemoryStream
aWriteFinal bool
aRes1 bool
aRes2 bool
return bool

SendBinary() public method

Send binary data
public SendBinary ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool
aStream System.IO.MemoryStream binary data
aWriteFinal bool whether frame is final
aRes1 bool extensions 1st bit
aRes2 bool extensions 2nd bit
aRes3 bool extensions 3nd bit
return bool

SendBinaryContinuation() public method

public SendBinaryContinuation ( MemoryStream aStream ) : bool
aStream System.IO.MemoryStream
return bool

SendBinaryContinuation() public method

public SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal ) : bool
aStream System.IO.MemoryStream
aWriteFinal bool
return bool

SendBinaryContinuation() public method

public SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal, bool aRes1 ) : bool
aStream System.IO.MemoryStream
aWriteFinal bool
aRes1 bool
return bool

SendBinaryContinuation() public method

public SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
aStream System.IO.MemoryStream
aWriteFinal bool
aRes1 bool
aRes2 bool
return bool

SendBinaryContinuation() public method

send binary continuation data see SendBinary for parameter and result response
public SendBinaryContinuation ( MemoryStream aStream, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool
aStream System.IO.MemoryStream binary data
aWriteFinal bool whether frame is final
aRes1 bool extensions 1st bit
aRes2 bool extensions 2nd bit
aRes3 bool extensions 3nd bit
return bool

SendData() public method

public SendData ( bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3, int aWriteCode, MemoryStream aStream ) : bool
aWriteFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aWriteCode int
aStream System.IO.MemoryStream
return bool

SendData() public method

public SendData ( bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3, int aWriteCode, String aData ) : bool
aWriteFinal bool
aRes1 bool
aRes2 bool
aRes3 bool
aWriteCode int
aData String
return bool

SendText() public method

public SendText ( String aString ) : bool
aString String
return bool

SendText() public method

public SendText ( String aString, bool aWriteFinal ) : bool
aString String
aWriteFinal bool
return bool

SendText() public method

public SendText ( String aString, bool aWriteFinal, bool aRes1 ) : bool
aString String
aWriteFinal bool
aRes1 bool
return bool

SendText() public method

public SendText ( String aString, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
aString String
aWriteFinal bool
aRes1 bool
aRes2 bool
return bool

SendText() public method

Send textual data
public SendText ( String aString, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool
aString String string data
aWriteFinal bool whether frame is final
aRes1 bool extensions 1st bit
aRes2 bool extensions 2nd bit
aRes3 bool extensions 3nd bit
return bool

SendTextContinuation() public method

public SendTextContinuation ( String aString ) : bool
aString String
return bool

SendTextContinuation() public method

public SendTextContinuation ( String aString, bool aWriteFinal ) : bool
aString String
aWriteFinal bool
return bool

SendTextContinuation() public method

public SendTextContinuation ( String aString, bool aWriteFinal, bool aRes1 ) : bool
aString String
aWriteFinal bool
aRes1 bool
return bool

SendTextContinuation() public method

public SendTextContinuation ( String aString, bool aWriteFinal, bool aRes1, bool aRes2 ) : bool
aString String
aWriteFinal bool
aRes1 bool
aRes2 bool
return bool

SendTextContinuation() public method

Send textual continuation data
public SendTextContinuation ( String aString, bool aWriteFinal, bool aRes1, bool aRes2, bool aRes3 ) : bool
aString String string data
aWriteFinal bool whether frame is final
aRes1 bool extensions 1st bit
aRes2 bool extensions 2nd bit
aRes3 bool extensions 3nd bit
return bool

StartRead() protected method

protected StartRead ( ) : void
return void

WebSocketConnection() public method

public WebSocketConnection ( ) : System
return System

WebSocketConnection() public method

public WebSocketConnection ( TcpClient aClient ) : System
aClient System.Net.Sockets.TcpClient
return System

getStream() protected method

protected getStream ( TcpClient aClient ) : Stream
aClient System.Net.Sockets.TcpClient
return Stream

Property Details

fClient protected property

protected TcpClient,System.Net.Sockets fClient
return System.Net.Sockets.TcpClient

fClosedByMe protected property

protected bool fClosedByMe
return bool

fClosedByPeer protected property

protected bool fClosedByPeer
return bool

fCookie protected property

protected string fCookie
return string

fExtension protected property

protected string fExtension
return string

fFullDataProcess protected property

protected bool fFullDataProcess
return bool

fHandshake protected property

protected bool fHandshake
return bool

fHeaders protected property

protected WebSocketHeaders,Bauglir.Ex fHeaders
return Bauglir.Ex.WebSocketHeaders

fHost protected property

protected string fHost
return string

fIndex protected property

protected int fIndex
return int

fMasking protected property

protected bool fMasking
return bool

fOrigin protected property

protected string fOrigin
return string

fPort protected property

protected string fPort
return string

fProtocol protected property

protected string fProtocol
return string

fRequireMask protected property

protected bool fRequireMask
return bool

fResourceName protected property

protected string fResourceName
return string

fSsl protected property

protected bool fSsl
return bool

fSslStream protected property

protected SslStream,System.Net.Security fSslStream
return System.Net.Security.SslStream

fVersion protected property

protected int fVersion
return int