C# Класс org.GraphDefined.Vanaheimr.Hermod.Sockets.TCP.TCPConnection

An abstract class for all TCP connections.
Наследование: AReadOnlyLocalRemoteSockets
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
Stream NetworkStream
TCPClient System.Net.Sockets.TcpClient

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

Метод Описание
Close ( ConnectionClosedBy ClosedBy = ConnectionClosedBy.Server ) : void

Close this TCP connection.

Dispose ( ) : void

Dispose this packet.

EnableTLSServer ( X509Certificate2 TLSCert ) : void
Flush ( ) : void
Read ( UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : Byte

Read a byte value from the TCP connection.

Read ( Byte Buffer, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : Int32

Read multiple byte values from the TCP connection into the given buffer.

ReadLine ( Int32 MaxLength = 65535, Encoding Encoding = null, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : String

Read a line from the TCP connection.

ReadString ( Int32 MaxLength = 1024, Encoding Encoding = null, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : String

Read a string value from the TCP connection.

TCPConnection ( TCPServer TCPServer, TcpClient TCPClient ) : System

Create a new TCP connection.

TryRead ( Byte &Byte, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 50 ) : TCPClientResponse

Try to read a byte value from the TCP connection.

WriteLineToResponseStream ( String UTF8Text ) : void

Writes some UTF-8 text to the underlying stream.

WriteToResponseStream ( Byte Byte ) : void

Writes the given byte to the underlying stream.

WriteToResponseStream ( Stream InputStream, Int32 ReadTimeout = 1000, Int32 BufferSize = 65535 ) : void

Reads the given input stream and writes its content to the underlying stream.

WriteToResponseStream ( String UTF8Text ) : void

Writes some UTF-8 text to the underlying stream.

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

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

Close this TCP connection.
public Close ( ConnectionClosedBy ClosedBy = ConnectionClosedBy.Server ) : void
ClosedBy ConnectionClosedBy
Результат void

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

Dispose this packet.
public Dispose ( ) : void
Результат void

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

public EnableTLSServer ( X509Certificate2 TLSCert ) : void
TLSCert System.Security.Cryptography.X509Certificates.X509Certificate2
Результат void

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

public Flush ( ) : void
Результат void

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

Read a byte value from the TCP connection.
public Read ( UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : Byte
SleepingTimeMS System.UInt16 When no data is currently available wait at least this amount of time [milliseconds].
MaxInitialWaitingTimeMS System.UInt32 When no data is currently available wait at most this amount of time [milliseconds].
Результат Byte

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

Read multiple byte values from the TCP connection into the given buffer.
public Read ( Byte Buffer, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : Int32
Buffer Byte An array of byte values.
SleepingTimeMS System.UInt16 When no data is currently available wait at least this amount of time [milliseconds].
MaxInitialWaitingTimeMS System.UInt32 When no data is currently available wait at most this amount of time [milliseconds].
Результат System.Int32

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

Read a line from the TCP connection.
public ReadLine ( Int32 MaxLength = 65535, Encoding Encoding = null, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : String
MaxLength System.Int32 The maximal length of the string.
Encoding System.Text.Encoding The character encoding of the string (default: UTF8).
SleepingTimeMS System.UInt16 When no data is currently available wait at least this amount of time [milliseconds].
MaxInitialWaitingTimeMS System.UInt32 When no data is currently available wait at most this amount of time [milliseconds].
Результат String

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

Read a string value from the TCP connection.
public ReadString ( Int32 MaxLength = 1024, Encoding Encoding = null, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 500 ) : String
MaxLength System.Int32 The maximal length of the string.
Encoding System.Text.Encoding The character encoding of the string (default: UTF8).
SleepingTimeMS System.UInt16 When no data is currently available wait at least this amount of time [milliseconds].
MaxInitialWaitingTimeMS System.UInt32 When no data is currently available wait at most this amount of time [milliseconds].
Результат String

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

Create a new TCP connection.
public TCPConnection ( TCPServer TCPServer, TcpClient TCPClient ) : System
TCPServer TCPServer
TCPClient System.Net.Sockets.TcpClient
Результат System

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

Try to read a byte value from the TCP connection.
public TryRead ( Byte &Byte, UInt16 SleepingTimeMS = 5, UInt32 MaxInitialWaitingTimeMS = 50 ) : TCPClientResponse
Byte Byte The byte value OR 0x00 if nothing could be read.
SleepingTimeMS System.UInt16 When no data is currently available wait at least this amount of time [milliseconds].
MaxInitialWaitingTimeMS System.UInt32 When no data is currently available wait at most this amount of time [milliseconds].
Результат TCPClientResponse

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

Writes some UTF-8 text to the underlying stream.
public WriteLineToResponseStream ( String UTF8Text ) : void
UTF8Text String Some UTF-8 text.
Результат void

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

Writes the given byte to the underlying stream.
public WriteToResponseStream ( Byte Byte ) : void
Byte Byte A single byte.
Результат void

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

Reads the given input stream and writes its content to the underlying stream.
public WriteToResponseStream ( Stream InputStream, Int32 ReadTimeout = 1000, Int32 BufferSize = 65535 ) : void
InputStream Stream A data source.
ReadTimeout System.Int32 A read timeout on the source.
BufferSize System.Int32 The buffer size for reading.
Результат void

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

Writes some UTF-8 text to the underlying stream.
public WriteToResponseStream ( String UTF8Text ) : void
UTF8Text String Some UTF-8 text.
Результат void

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

Stream защищенное свойство

protected NetworkStream Stream
Результат NetworkStream

TCPClient защищенное свойство

protected TcpClient,System.Net.Sockets TCPClient
Результат System.Net.Sockets.TcpClient