Connection
Overview
The Stream based Connection class is the basis for all communications between clients and servers. Clients can obtain a Connection object by calling one of the Connect methods of the Client component; Servers will obtain Connection objects for every incoming connection that gets established.
Connection provides a variety of functions to enable sending and receiving of data with minimal code. Connection also provides protected methods that can be overridden in descendant classes to extend the Connection - for example to implement SSL encryption, compression or other protocol specifc or user-defined handing.
Location
-
Reference:
- RemObjects.InternetPack.dll .NET, .NET Core 5.0, .NET Standard 2.0
- RemObjects.InternetPack.fx Island
- libRemObjects.InternetPack.fx Toffee
- Namespace: RemObjects.InternetPack
-
Ancestry:
- Stream | Connection .NET, .NET Standard 2.0, Island, Toffee
- Stream | Connection .NET Core 5.0
- Stream | Connection .NET, .NET Standard 2.0, Island, Toffee
constructor (Binding)
constructor(binding: Binding)
Connection(Binding binding)
init(_ binding: Binding)
Sub New(binding As Binding)
Parameters:
- binding:
constructor (Socket)
constructor(socket: Socket)
Connection(Socket socket)
init(_ socket: Socket)
Sub New(socket As Socket)
Parameters:
- socket:
AsyncDisconnect
event AsyncDisconnect: EventHandler
delegate EventHandler AsyncDisconnect()
__event EventHandler: AsyncDisconnect!
Event AsyncDisconnect As EventHandler
AsyncHaveIncompleteData
event AsyncHaveIncompleteData: EventHandler
delegate EventHandler AsyncHaveIncompleteData()
__event EventHandler: AsyncHaveIncompleteData!
Event AsyncHaveIncompleteData As EventHandler
Available virtual
Returns the number of bytes available in the local receive buffer.
Override this method in descendant Connection classes if you need to perform additional handling or calculation on the size of available data.
property Available: Int32 read;
Int32 Available { get; }
var Available: Int32 { get{} }
ReadOnly Property Available() As Int32
method BeginConnect(address: IPAddress; port: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginConnect(IPAddress address, Int32 port, AsyncCallback callback, Object state)
func BeginConnect(_ address: IPAddress, _ port: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginConnect(address As IPAddress, port As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- address:
- port:
- callback:
- state:
BeginConnect (EndPoint, AsyncCallback, Object): IAsyncResult virtual
method BeginConnect(endPoint: EndPoint; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginConnect(EndPoint endPoint, AsyncCallback callback, Object state)
func BeginConnect(_ endPoint: EndPoint, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginConnect(endPoint As EndPoint, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- endPoint:
- callback:
- state:
BeginInitializeServerConnection protected virtual
method BeginInitializeServerConnection(callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginInitializeServerConnection(AsyncCallback callback, Object state)
func BeginInitializeServerConnection(_ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginInitializeServerConnection(callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- callback:
- state:
BeginRead virtual
method BeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func BeginRead(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
BeginReadLine virtual
method BeginReadLine(callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginReadLine(AsyncCallback callback, Object state)
func BeginReadLine(_ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginReadLine(callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- callback:
- state:
BeginWrite virtual
method BeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func BeginWrite(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
Binding virtual
property Binding: Binding read;
Binding Binding { get; }
var Binding: Binding { get{} }
ReadOnly Property Binding() As Binding
BufferedAsync virtual
property BufferedAsync: Boolean read write;
Boolean BufferedAsync { get; set; }
var BufferedAsync: Boolean { get{} set{} }
Property BufferedAsync() As Boolean
BufferReadLine virtual
method BufferReadLine: String
String BufferReadLine()
func BufferReadLine() -> String
Function BufferReadLine() As String
BytesReceived virtual
property BytesReceived: Int64 read;
Int64 BytesReceived { get; }
var BytesReceived: Int64 { get{} }
ReadOnly Property BytesReceived() As Int64
BytesSent virtual
property BytesSent: Int64 read;
Int64 BytesSent { get; }
var BytesSent: Int64 { get{} }
ReadOnly Property BytesSent() As Int64
CanRead override
property CanRead: Boolean read;
Boolean CanRead { get; }
var CanRead: Boolean { get{} }
ReadOnly Property CanRead() As Boolean
CanSeek override
property CanSeek: Boolean read;
Boolean CanSeek { get; }
var CanSeek: Boolean { get{} }
ReadOnly Property CanSeek() As Boolean
CanWrite override
property CanWrite: Boolean read;
Boolean CanWrite { get; }
var CanWrite: Boolean { get{} }
ReadOnly Property CanWrite() As Boolean
Close override
Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.
method Close
void Close()
func Close()
Sub Close()
Connect (IPAddress, Int32) virtual
method Connect(address: IPAddress; port: Int32)
void Connect(IPAddress address, Int32 port)
func Connect(_ address: IPAddress, _ port: Int32)
Sub Connect(address As IPAddress, port As Int32)
Parameters:
- address:
- port:
Connect (EndPoint) virtual
Opens a connection to the target remote system.
method Connect(endPoint: EndPoint)
void Connect(EndPoint endPoint)
func Connect(_ endPoint: EndPoint)
Sub Connect(endPoint As EndPoint)
Parameters:
- endPoint:
Connected virtual
The boolean Connected property can be evaluated at any given time to find out if the Connection object is referring to an open Connection. When a connection is first obtained, it will be open and the property will be true. Once the connection has been closed, whether purposely or by remote, the property will turn to false.
property Connected: Boolean read;
Boolean Connected { get; }
var Connected: Boolean { get{} }
ReadOnly Property Connected() As Boolean
CopyTo virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Copy the content of this stream to another
method CopyTo(Destination: Stream)
void CopyTo(Stream Destination)
func CopyTo(_ Destination: Stream)
Sub CopyTo(Destination As Stream)
Parameters:
- Destination:
CRLF
var CRLF: array of Byte;
Byte[] CRLF
var CRLF: Byte...
FIELD CRLF() As Byte()
DataSocket virtual
property DataSocket: Socket read;
Socket DataSocket { get; }
var DataSocket: Socket { get{} }
ReadOnly Property DataSocket() As Socket
DataSocketAvailable virtual
property DataSocketAvailable: Int32 read;
Int32 DataSocketAvailable { get; }
var DataSocketAvailable: Int32 { get{} }
ReadOnly Property DataSocketAvailable() As Int32
DataSocketClose protected virtual
method DataSocketClose
void DataSocketClose()
func DataSocketClose()
Sub DataSocketClose()
DataSocketClose (Boolean) protected virtual
method DataSocketClose(dispose: Boolean)
void DataSocketClose(Boolean dispose)
func DataSocketClose(_ dispose: Boolean)
Sub DataSocketClose(dispose As Boolean)
Parameters:
- dispose:
DataSocketConnect protected virtual
method DataSocketConnect(endPoint: EndPoint)
void DataSocketConnect(EndPoint endPoint)
func DataSocketConnect(_ endPoint: EndPoint)
Sub DataSocketConnect(endPoint As EndPoint)
Parameters:
- endPoint:
DataSocketConnected virtual
Specified if the underlying DataSocket is connected.
Override this property in descendant Connection classes if you need additional logic to dertermine if a valid connection is avilable. For example, a secure connection might revert to a disconnected state if certain handshaking with the remote has failed, even though the physical socket is still actually connected.
property DataSocketConnected: Boolean read;
Boolean DataSocketConnected { get; }
var DataSocketConnected: Boolean { get{} }
ReadOnly Property DataSocketConnected() As Boolean
DataSocketReceiveWhatsAvaiable protected virtual
method DataSocketReceiveWhatsAvaiable(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 DataSocketReceiveWhatsAvaiable(Byte[] buffer, Int32 offset, Int32 size)
func DataSocketReceiveWhatsAvaiable(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function DataSocketReceiveWhatsAvaiable(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
DataSocketSend protected virtual
method DataSocketSend(buffer: array of Byte): Int32
Int32 DataSocketSend(Byte[] buffer)
func DataSocketSend(_ buffer: Byte...) -> Int32
Function DataSocketSend(buffer As Byte()) As Int32
Parameters:
- buffer:
DataSocketSendAsMuchAsPossible protected virtual
method DataSocketSendAsMuchAsPossible(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 DataSocketSendAsMuchAsPossible(Byte[] buffer, Int32 offset, Int32 size)
func DataSocketSendAsMuchAsPossible(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function DataSocketSendAsMuchAsPossible(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
description override Toffee
func description() -> NSString
Disconnect virtual
Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.
method Disconnect
void Disconnect()
func Disconnect()
Sub Disconnect()
Dispose
method Dispose
void Dispose()
func Dispose()
Sub Dispose()
EnableNagle virtual
property EnableNagle: Boolean read write;
Boolean EnableNagle { get; set; }
var EnableNagle: Boolean { get{} set{} }
Property EnableNagle() As Boolean
Encoding virtual
property Encoding: Encoding read write;
Encoding Encoding { get; set; }
var Encoding: Encoding { get{} set{} }
Property Encoding() As Encoding
EndConnect virtual
method EndConnect(ar: IAsyncResult)
void EndConnect(IAsyncResult ar)
func EndConnect(_ ar: IAsyncResult)
Sub EndConnect(ar As IAsyncResult)
Parameters:
- ar:
EndInitializeServerConnection protected virtual
method EndInitializeServerConnection(ar: IAsyncResult)
void EndInitializeServerConnection(IAsyncResult ar)
func EndInitializeServerConnection(_ ar: IAsyncResult)
Sub EndInitializeServerConnection(ar As IAsyncResult)
Parameters:
- ar:
EndRead virtual
method EndRead(ar: IAsyncResult): Int32
Int32 EndRead(IAsyncResult ar)
func EndRead(_ ar: IAsyncResult) -> Int32
Function EndRead(ar As IAsyncResult) As Int32
Parameters:
- ar:
EndReadLine virtual
method EndReadLine(ar: IAsyncResult): String
String EndReadLine(IAsyncResult ar)
func EndReadLine(_ ar: IAsyncResult) -> String
Function EndReadLine(ar As IAsyncResult) As String
Parameters:
- ar:
EndWrite virtual
method EndWrite(ar: IAsyncResult)
void EndWrite(IAsyncResult ar)
func EndWrite(_ ar: IAsyncResult)
Sub EndWrite(ar As IAsyncResult)
Parameters:
- ar:
Flush override
method Flush
void Flush()
func Flush()
Sub Flush()
GetLength override
method GetLength: Int64
Int64 GetLength()
func GetLength() -> Int64
Function GetLength() As Int64
GetPosition override
method GetPosition: Int64
Int64 GetPosition()
func GetPosition() -> Int64
Function GetPosition() As Int64
Init virtual
method Init(socket: Socket)
void Init(Socket socket)
func Init(_ socket: Socket)
Sub Init(socket As Socket)
Parameters:
- socket:
InitializeServerConnection protected virtual
method InitializeServerConnection
void InitializeServerConnection()
func InitializeServerConnection()
Sub InitializeServerConnection()
IntBeginRead protected virtual
method IntBeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult IntBeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func IntBeginRead(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function IntBeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
IntBeginWrite protected virtual
method IntBeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult IntBeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func IntBeginWrite(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function IntBeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
IntEndRead protected virtual
method IntEndRead(ar: IAsyncResult): Int32
Int32 IntEndRead(IAsyncResult ar)
func IntEndRead(_ ar: IAsyncResult) -> Int32
Function IntEndRead(ar As IAsyncResult) As Int32
Parameters:
- ar:
IntEndWrite protected virtual
method IntEndWrite(ar: IAsyncResult)
void IntEndWrite(IAsyncResult ar)
func IntEndWrite(_ ar: IAsyncResult)
Sub IntEndWrite(ar As IAsyncResult)
Parameters:
- ar:
LastUsed virtual
property LastUsed: DateTime read write;
DateTime LastUsed { get; set; }
var LastUsed: DateTime { get{} set{} }
Property LastUsed() As DateTime
Length virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Returns the length of this stream.
property Length: Int64 read;
Int64 Length { get; }
var Length: Int64 { get{} }
ReadOnly Property Length() As Int64
LF
var LF: array of Byte;
Byte[] LF
var LF: Byte...
FIELD LF() As Byte()
LocalEndPoint virtual
LocalEndPoint specifies the local address that this connection is assigned to. For clients, this will usually be a random port and IP address; for servers, this will be the port and IP address that the connection came in on. Use the RemoteEndPoint property to find out details about the opposite side of the connection.
property LocalEndPoint: EndPoint read;
EndPoint LocalEndPoint { get; }
var LocalEndPoint: EndPoint { get{} }
ReadOnly Property LocalEndPoint() As EndPoint
MaxLineLength virtual
The MaxLineLength property specifies the maximum number of bytes that a ReadLine operation will receive. The maximum line checking can be activated by the MaxLineLengthEnabled property, the default value is 1024 bytes (1kB).
property MaxLineLength: Int32 read write;
Int32 MaxLineLength { get; set; }
var MaxLineLength: Int32 { get{} set{} }
Property MaxLineLength() As Int32
MaxLineLengthEnabled virtual
The MaxLineLengthEnabled property toggles whether the ReadLine function will enforce a maximum line length. When turned on (true), ReadLine will fail and the connection will be terminated if the remote side sends a line longer than the defined MaxLineLength bytes.
On Servers MaxLineLengthEnabled is set to true by default for security reasons. This will prevent malicious clients from sending endless strings for servers that read data on a line-by-line basis (for example for HTTP Headers, or the SMTP and POP3 protocols), to prevent clients from wasting server resources by sending strings that exceed the available server memory.
property MaxLineLengthEnabled: Boolean read write;
Boolean MaxLineLengthEnabled { get; set; }
var MaxLineLengthEnabled: Boolean { get{} set{} }
Property MaxLineLengthEnabled() As Boolean
OnBytesReceived
event OnBytesReceived: EventHandler
delegate EventHandler OnBytesReceived()
__event EventHandler: OnBytesReceived!
Event OnBytesReceived As EventHandler
OnBytesSent
event OnBytesSent: EventHandler
delegate EventHandler OnBytesSent()
__event EventHandler: OnBytesSent!
Event OnBytesSent As EventHandler
OriginalEndpoint virtual
property OriginalEndpoint: EndPoint read write;
EndPoint OriginalEndpoint { get; set; }
var OriginalEndpoint: EndPoint { get{} set{} }
Property OriginalEndpoint() As EndPoint
Pool virtual
property Pool: ConnectionPool read write;
ConnectionPool Pool { get; set; }
var Pool: ConnectionPool { get{} set{} }
Property Pool() As ConnectionPool
Position override
property Position: Int64 read write;
Int64 Position { get; set; }
var Position: Int64 { get{} set{} }
Property Position() As Int64
Read from this stream. Returns the nr of bytes retreived., or 0 when the end has been reached.
method Read(Buffer: array of Byte; Count: Int32): Int32
Int32 Read(Byte[] Buffer, Int32 Count)
func Read(_ Buffer: Byte..., _ Count: Int32) -> Int32
Function Read(Buffer As Byte(), Count As Int32) As Int32
Parameters:
- Buffer:
- Count:
The Read method is provided for compatibility with the Stream base class; it behaves identically to Receive. It will block until the entire buffer is filled or the connection has been closed.
method Read(buffer: array of Byte; offset: Int32; count: Int32): Int32
Int32 Read(Byte[] buffer, Int32 offset, Int32 count)
func Read(_ buffer: Byte..., _ offset: Int32, _ count: Int32) -> Int32
Function Read(buffer As Byte(), offset As Int32, count As Int32) As Int32
Parameters:
- buffer:
- offset:
- count:
ReadByte virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Reads a byte or returns -1 if the stream has reached the end
method ReadByte: Int32
Int32 ReadByte()
func ReadByte() -> Int32
Function ReadByte() As Int32
method ReadByte(out aResult: Byte): Boolean
Boolean ReadByte(out Byte aResult)
func ReadByte(_ aResult: inout Byte) -> Boolean
Function ReadByte(<OutAttribute> ByRef aResult As Byte) As Boolean
Parameters:
- aResult:
ReadGuid (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadGuid(out aResult: Guid): Boolean
Boolean ReadGuid(out Guid aResult)
func ReadGuid(_ aResult: inout Guid) -> Boolean
Function ReadGuid(<OutAttribute> ByRef aResult As Guid) As Boolean
Parameters:
- aResult:
ReadLine virtual
ReadLine will read data from the connection until a linebreak (either a CR LF or a single LF) is received.
If MaxLineLengthEnabled is active, ReadLine will take security precautions to ensure the remote side is not sending too long strings.
method ReadLine: String
String ReadLine()
func ReadLine() -> String
Function ReadLine() As String
ReadUInt16BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt16BE(out aResult: UInt16): Boolean
Boolean ReadUInt16BE(out UInt16 aResult)
func ReadUInt16BE(_ aResult: inout UInt16) -> Boolean
Function ReadUInt16BE(<OutAttribute> ByRef aResult As UInt16) As Boolean
Parameters:
- aResult:
ReadUInt16LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt16LE(out aResult: UInt16): Boolean
Boolean ReadUInt16LE(out UInt16 aResult)
func ReadUInt16LE(_ aResult: inout UInt16) -> Boolean
Function ReadUInt16LE(<OutAttribute> ByRef aResult As UInt16) As Boolean
Parameters:
- aResult:
ReadUInt32BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt32BE(out aResult: UInt32): Boolean
Boolean ReadUInt32BE(out UInt32 aResult)
func ReadUInt32BE(_ aResult: inout UInt32) -> Boolean
Function ReadUInt32BE(<OutAttribute> ByRef aResult As UInt32) As Boolean
Parameters:
- aResult:
ReadUInt32LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt32LE(out aResult: UInt32): Boolean
Boolean ReadUInt32LE(out UInt32 aResult)
func ReadUInt32LE(_ aResult: inout UInt32) -> Boolean
Function ReadUInt32LE(<OutAttribute> ByRef aResult As UInt32) As Boolean
Parameters:
- aResult:
ReadUInt64BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt64BE(out aResult: UInt64): Boolean
Boolean ReadUInt64BE(out UInt64 aResult)
func ReadUInt64BE(_ aResult: inout UInt64) -> Boolean
Function ReadUInt64BE(<OutAttribute> ByRef aResult As UInt64) As Boolean
Parameters:
- aResult:
ReadUInt64LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt64LE(out aResult: UInt64): Boolean
Boolean ReadUInt64LE(out UInt64 aResult)
func ReadUInt64LE(_ aResult: inout UInt64) -> Boolean
Function ReadUInt64LE(<OutAttribute> ByRef aResult As UInt64) As Boolean
Parameters:
- aResult:
Receive reads bytes from the connection. This function can be blocked to wait for additional incoming data.
method Receive(buffer: array of Byte): Int32
Int32 Receive(Byte[] buffer)
func Receive(_ buffer: Byte...) -> Int32
Function Receive(buffer As Byte()) As Int32
Parameters:
- buffer:
method Receive(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 Receive(Byte[] buffer, Int32 offset, Int32 size)
func Receive(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function Receive(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
ReceiveAllRemaining virtual
method ReceiveAllRemaining: array of Byte
Byte[] ReceiveAllRemaining()
func ReceiveAllRemaining() -> Byte...
Function ReceiveAllRemaining() As Byte()
method ReceiveAllRemaining(bufferSize: Int32): array of Byte
Byte[] ReceiveAllRemaining(Int32 bufferSize)
func ReceiveAllRemaining(_ bufferSize: Int32) -> Byte...
Function ReceiveAllRemaining(bufferSize As Int32) As Byte()
Parameters:
- bufferSize:
ReceiveToStream (Stream) virtual
method ReceiveToStream(stream: Stream)
void ReceiveToStream(Stream stream)
func ReceiveToStream(_ stream: Stream)
Sub ReceiveToStream(stream As Stream)
Parameters:
- stream:
method ReceiveToStream(stream: Stream; size: Int64)
void ReceiveToStream(Stream stream, Int64 size)
func ReceiveToStream(_ stream: Stream, _ size: Int64)
Sub ReceiveToStream(stream As Stream, size As Int64)
Parameters:
- stream:
- size:
method ReceiveToStream(stream: Stream; size: Int64; bufferSize: Int32)
void ReceiveToStream(Stream stream, Int64 size, Int32 bufferSize)
func ReceiveToStream(_ stream: Stream, _ size: Int64, _ bufferSize: Int32)
Sub ReceiveToStream(stream As Stream, size As Int64, bufferSize As Int32)
Parameters:
- stream:
- size:
- bufferSize:
ReceiveWhatsAvailable virtual
ReceiveWhatsAvailable reads bytes from the connection to fill the passed byte[] buffer. Unlike Receive, this function will not block to wait for additional incoming data, but return immediately with the data that was available.
method ReceiveWhatsAvailable(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 ReceiveWhatsAvailable(Byte[] buffer, Int32 offset, Int32 size)
func ReceiveWhatsAvailable(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function ReceiveWhatsAvailable(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
RemoteEndPoint virtual
RemoteEndPoint specifies the remote address that this connection is assigned to. For clients, this will be the port and IP address that they connected to; for servers, this will usually be a random port on the client, and the IP address of the connected client. Use the LocalEndPoint property to find out details about the local side of the connection.
property RemoteEndPoint: EndPoint read;
EndPoint RemoteEndPoint { get; }
var RemoteEndPoint: EndPoint { get{} }
ReadOnly Property RemoteEndPoint() As EndPoint
ResetStatistics virtual
method ResetStatistics
void ResetStatistics()
func ResetStatistics()
Sub ResetStatistics()
Secure virtual
property Secure: Boolean read;
Boolean Secure { get; }
var Secure: Boolean { get{} }
ReadOnly Property Secure() As Boolean
Seek override
method Seek(offset: Int64; origin: SeekOrigin): Int64
Int64 Seek(Int64 offset, SeekOrigin origin)
func Seek(_ offset: Int64, _ origin: SeekOrigin) -> Int64
Function Seek(offset As Int64, origin As SeekOrigin) As Int64
Parameters:
- offset:
- origin:
This method sends a block of data to the remote side.
method Send(buffer: array of Byte): Int32
Int32 Send(Byte[] buffer)
func Send(_ buffer: Byte...) -> Int32
Function Send(buffer As Byte()) As Int32
Parameters:
- buffer:
method Send(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 Send(Byte[] buffer, Int32 offset, Int32 size)
func Send(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function Send(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
SendFromStream (Stream) virtual
method SendFromStream(stream: Stream)
void SendFromStream(Stream stream)
func SendFromStream(_ stream: Stream)
Sub SendFromStream(stream As Stream)
Parameters:
- stream:
method SendFromStream(stream: Stream; size: Int64)
void SendFromStream(Stream stream, Int64 size)
func SendFromStream(_ stream: Stream, _ size: Int64)
Sub SendFromStream(stream As Stream, size As Int64)
Parameters:
- stream:
- size:
method SendFromStream(stream: Stream; size: Int64; bufferSize: Int32)
void SendFromStream(Stream stream, Int64 size, Int32 bufferSize)
func SendFromStream(_ stream: Stream, _ size: Int64, _ bufferSize: Int32)
Sub SendFromStream(stream As Stream, size As Int64, bufferSize As Int32)
Parameters:
- stream:
- size:
- bufferSize:
SetPosition override virtual .NET, .NET Core 5.0, .NET Standard 2.0, Island
method SetPosition(value: Int64)
void SetPosition(Int64 value)
func SetPosition(_ value: Int64)
Sub SetPosition(value As Int64)
Parameters:
- value:
SkipBytes virtual
method SkipBytes(size: Int32)
void SkipBytes(Int32 size)
func SkipBytes(_ size: Int32)
Sub SkipBytes(size As Int32)
Parameters:
- size:
StartTimeoutTimer protected virtual
method StartTimeoutTimer
void StartTimeoutTimer()
func StartTimeoutTimer()
Sub StartTimeoutTimer()
StopTimeoutTimer protected virtual
method StopTimeoutTimer
void StopTimeoutTimer()
func StopTimeoutTimer()
Sub StopTimeoutTimer()
TimedOut virtual
property TimedOut: Boolean read;
Boolean TimedOut { get; }
var TimedOut: Boolean { get{} }
ReadOnly Property TimedOut() As Boolean
Timeout virtual
The Timeout property specifies the maximum amout of time (in seconds) that a Connection will wait for incoming data within a single Receive operation. The timeout handling can be activated by the TimeoutEnabled property, the default value is 5 minutes.
property Timeout: Int32 read write;
Int32 Timeout { get; set; }
var Timeout: Int32 { get{} set{} }
Property Timeout() As Int32
TimeoutEnabled virtual
The TimeoutEnabled property toggles whether the Connection will do automatic timeout checking. When turned on (true), the Connection will keep track of the time that passes during any single Receive operation - if a receive operation takes longer than the given timeout, the connection will be terminated. The Timeout property controls the length of this timeout period. On Servers, TimeoutEnabled is set to true by default for security reasons. This will prevent malicious clients from opening connections and keeping them idling for long periods of time as parts of Denial of Service attacks.
property TimeoutEnabled: Boolean read write;
Boolean TimeoutEnabled { get; set; }
var TimeoutEnabled: Boolean { get{} set{} }
Property TimeoutEnabled() As Boolean
ToString virtual
method ToString: PlatformString
PlatformString ToString()
func ToString() -> String
Function ToString() As PlatformString
TriggerAsyncDisconnect protected virtual
method TriggerAsyncDisconnect
void TriggerAsyncDisconnect()
func TriggerAsyncDisconnect()
Sub TriggerAsyncDisconnect()
TriggerAsyncHaveIncompleteData protected virtual
method TriggerAsyncHaveIncompleteData
void TriggerAsyncHaveIncompleteData()
func TriggerAsyncHaveIncompleteData()
Sub TriggerAsyncHaveIncompleteData()
TriggerOnBytesReceived protected virtual
method TriggerOnBytesReceived(count: Int64)
void TriggerOnBytesReceived(Int64 count)
func TriggerOnBytesReceived(_ count: Int64)
Sub TriggerOnBytesReceived(count As Int64)
Parameters:
- count:
TriggerOnBytesSent protected virtual
method TriggerOnBytesSent(count: Int64)
void TriggerOnBytesSent(Int64 count)
func TriggerOnBytesSent(_ count: Int64)
Sub TriggerOnBytesSent(count As Int64)
Parameters:
- count:
method Write(Buffer: array of Byte): Int32
Int32 Write(Byte[] Buffer)
func Write(_ Buffer: Byte...) -> Int32
Function Write(Buffer As Byte()) As Int32
Parameters:
- Buffer:
Writes data to the stream.
method Write(Buffer: array of Byte; Count: Int32): Int32
Int32 Write(Byte[] Buffer, Int32 Count)
func Write(_ Buffer: Byte..., _ Count: Int32) -> Int32
Function Write(Buffer As Byte(), Count As Int32) As Int32
Parameters:
- Buffer:
- Count:
method Write(buffer: array of Byte; offset: Int32; count: Int32): Int32
Int32 Write(Byte[] buffer, Int32 offset, Int32 count)
func Write(_ buffer: Byte..., _ offset: Int32, _ count: Int32) -> Int32
Function Write(buffer As Byte(), offset As Int32, count As Int32) As Int32
Parameters:
- buffer:
- offset:
- count:
WriteByte virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Writes data to the stream.
method WriteByte(aValue: Byte)
void WriteByte(Byte aValue)
func WriteByte(_ aValue: Byte)
Sub WriteByte(aValue As Byte)
Parameters:
- aValue:
WriteGuid (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteGuid(value: Guid): Boolean
Boolean WriteGuid(Guid value)
func WriteGuid(_ value: Guid) -> Boolean
Function WriteGuid(value As Guid) As Boolean
Parameters:
- value:
WriteLine (String) virtual
The WriteLine method is similar to the Write method, but as in-parameter WriteLine it receives a string and finishes writing with carriage-return line feed character CRLF.
method WriteLine(line: String)
void WriteLine(String line)
func WriteLine(_ line: String)
Sub WriteLine(line As String)
Parameters:
- line:
method WriteLine(line: String; params args: array of Object)
void WriteLine(String line, params Object[] args)
func WriteLine(_ line: String, _ args: Object...)
Sub WriteLine(line As String, ParamArray args As Object())
Parameters:
- line:
- args:
WriteLineLF (String) virtual
The WriteLineLF method is similar to the Write method, but as in-parameter WriteLineLF it receives a string and finishes writing with line feed character CRLF.
method WriteLineLF(line: String)
void WriteLineLF(String line)
func WriteLineLF(_ line: String)
Sub WriteLineLF(line As String)
Parameters:
- line:
method WriteLineLF(line: String; params args: array of Object)
void WriteLineLF(String line, params Object[] args)
func WriteLineLF(_ line: String, _ args: Object...)
Sub WriteLineLF(line As String, ParamArray args As Object())
Parameters:
- line:
- args:
WriteUInt16BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt16BE(value: UInt16): Boolean
Boolean WriteUInt16BE(UInt16 value)
func WriteUInt16BE(_ value: UInt16) -> Boolean
Function WriteUInt16BE(value As UInt16) As Boolean
Parameters:
- value:
WriteUInt16LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt16LE(value: UInt16): Boolean
Boolean WriteUInt16LE(UInt16 value)
func WriteUInt16LE(_ value: UInt16) -> Boolean
Function WriteUInt16LE(value As UInt16) As Boolean
Parameters:
- value:
WriteUInt32BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt32BE(value: UInt32): Boolean
Boolean WriteUInt32BE(UInt32 value)
func WriteUInt32BE(_ value: UInt32) -> Boolean
Function WriteUInt32BE(value As UInt32) As Boolean
Parameters:
- value:
WriteUInt32LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt32LE(value: UInt32): Boolean
Boolean WriteUInt32LE(UInt32 value)
func WriteUInt32LE(_ value: UInt32) -> Boolean
Function WriteUInt32LE(value As UInt32) As Boolean
Parameters:
- value:
WriteUInt64BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt64BE(value: UInt64): Boolean
Boolean WriteUInt64BE(UInt64 value)
func WriteUInt64BE(_ value: UInt64) -> Boolean
Function WriteUInt64BE(value As UInt64) As Boolean
Parameters:
- value:
WriteUInt64LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt64LE(value: UInt64): Boolean
Boolean WriteUInt64LE(UInt64 value)
func WriteUInt64LE(_ value: UInt64) -> Boolean
Function WriteUInt64LE(value As UInt64) As Boolean
Parameters:
- value:
CRLF
var CRLF: array of Byte;
Byte[] CRLF
var CRLF: Byte...
FIELD CRLF() As Byte()
LF
var LF: array of Byte;
Byte[] LF
var LF: Byte...
FIELD LF() As Byte()
Available virtual
Returns the number of bytes available in the local receive buffer.
Override this method in descendant Connection classes if you need to perform additional handling or calculation on the size of available data.
property Available: Int32 read;
Int32 Available { get; }
var Available: Int32 { get{} }
ReadOnly Property Available() As Int32
Binding virtual
property Binding: Binding read;
Binding Binding { get; }
var Binding: Binding { get{} }
ReadOnly Property Binding() As Binding
BufferedAsync virtual
property BufferedAsync: Boolean read write;
Boolean BufferedAsync { get; set; }
var BufferedAsync: Boolean { get{} set{} }
Property BufferedAsync() As Boolean
BytesReceived virtual
property BytesReceived: Int64 read;
Int64 BytesReceived { get; }
var BytesReceived: Int64 { get{} }
ReadOnly Property BytesReceived() As Int64
BytesSent virtual
property BytesSent: Int64 read;
Int64 BytesSent { get; }
var BytesSent: Int64 { get{} }
ReadOnly Property BytesSent() As Int64
CanRead override
property CanRead: Boolean read;
Boolean CanRead { get; }
var CanRead: Boolean { get{} }
ReadOnly Property CanRead() As Boolean
CanSeek override
property CanSeek: Boolean read;
Boolean CanSeek { get; }
var CanSeek: Boolean { get{} }
ReadOnly Property CanSeek() As Boolean
CanWrite override
property CanWrite: Boolean read;
Boolean CanWrite { get; }
var CanWrite: Boolean { get{} }
ReadOnly Property CanWrite() As Boolean
Connected virtual
The boolean Connected property can be evaluated at any given time to find out if the Connection object is referring to an open Connection. When a connection is first obtained, it will be open and the property will be true. Once the connection has been closed, whether purposely or by remote, the property will turn to false.
property Connected: Boolean read;
Boolean Connected { get; }
var Connected: Boolean { get{} }
ReadOnly Property Connected() As Boolean
DataSocket virtual
property DataSocket: Socket read;
Socket DataSocket { get; }
var DataSocket: Socket { get{} }
ReadOnly Property DataSocket() As Socket
DataSocketAvailable virtual
property DataSocketAvailable: Int32 read;
Int32 DataSocketAvailable { get; }
var DataSocketAvailable: Int32 { get{} }
ReadOnly Property DataSocketAvailable() As Int32
DataSocketConnected virtual
Specified if the underlying DataSocket is connected.
Override this property in descendant Connection classes if you need additional logic to dertermine if a valid connection is avilable. For example, a secure connection might revert to a disconnected state if certain handshaking with the remote has failed, even though the physical socket is still actually connected.
property DataSocketConnected: Boolean read;
Boolean DataSocketConnected { get; }
var DataSocketConnected: Boolean { get{} }
ReadOnly Property DataSocketConnected() As Boolean
EnableNagle virtual
property EnableNagle: Boolean read write;
Boolean EnableNagle { get; set; }
var EnableNagle: Boolean { get{} set{} }
Property EnableNagle() As Boolean
Encoding virtual
property Encoding: Encoding read write;
Encoding Encoding { get; set; }
var Encoding: Encoding { get{} set{} }
Property Encoding() As Encoding
LastUsed virtual
property LastUsed: DateTime read write;
DateTime LastUsed { get; set; }
var LastUsed: DateTime { get{} set{} }
Property LastUsed() As DateTime
Length virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Returns the length of this stream.
property Length: Int64 read;
Int64 Length { get; }
var Length: Int64 { get{} }
ReadOnly Property Length() As Int64
LocalEndPoint virtual
LocalEndPoint specifies the local address that this connection is assigned to. For clients, this will usually be a random port and IP address; for servers, this will be the port and IP address that the connection came in on. Use the RemoteEndPoint property to find out details about the opposite side of the connection.
property LocalEndPoint: EndPoint read;
EndPoint LocalEndPoint { get; }
var LocalEndPoint: EndPoint { get{} }
ReadOnly Property LocalEndPoint() As EndPoint
MaxLineLength virtual
The MaxLineLength property specifies the maximum number of bytes that a ReadLine operation will receive. The maximum line checking can be activated by the MaxLineLengthEnabled property, the default value is 1024 bytes (1kB).
property MaxLineLength: Int32 read write;
Int32 MaxLineLength { get; set; }
var MaxLineLength: Int32 { get{} set{} }
Property MaxLineLength() As Int32
MaxLineLengthEnabled virtual
The MaxLineLengthEnabled property toggles whether the ReadLine function will enforce a maximum line length. When turned on (true), ReadLine will fail and the connection will be terminated if the remote side sends a line longer than the defined MaxLineLength bytes.
On Servers MaxLineLengthEnabled is set to true by default for security reasons. This will prevent malicious clients from sending endless strings for servers that read data on a line-by-line basis (for example for HTTP Headers, or the SMTP and POP3 protocols), to prevent clients from wasting server resources by sending strings that exceed the available server memory.
property MaxLineLengthEnabled: Boolean read write;
Boolean MaxLineLengthEnabled { get; set; }
var MaxLineLengthEnabled: Boolean { get{} set{} }
Property MaxLineLengthEnabled() As Boolean
OriginalEndpoint virtual
property OriginalEndpoint: EndPoint read write;
EndPoint OriginalEndpoint { get; set; }
var OriginalEndpoint: EndPoint { get{} set{} }
Property OriginalEndpoint() As EndPoint
Pool virtual
property Pool: ConnectionPool read write;
ConnectionPool Pool { get; set; }
var Pool: ConnectionPool { get{} set{} }
Property Pool() As ConnectionPool
Position override
property Position: Int64 read write;
Int64 Position { get; set; }
var Position: Int64 { get{} set{} }
Property Position() As Int64
RemoteEndPoint virtual
RemoteEndPoint specifies the remote address that this connection is assigned to. For clients, this will be the port and IP address that they connected to; for servers, this will usually be a random port on the client, and the IP address of the connected client. Use the LocalEndPoint property to find out details about the local side of the connection.
property RemoteEndPoint: EndPoint read;
EndPoint RemoteEndPoint { get; }
var RemoteEndPoint: EndPoint { get{} }
ReadOnly Property RemoteEndPoint() As EndPoint
Secure virtual
property Secure: Boolean read;
Boolean Secure { get; }
var Secure: Boolean { get{} }
ReadOnly Property Secure() As Boolean
TimedOut virtual
property TimedOut: Boolean read;
Boolean TimedOut { get; }
var TimedOut: Boolean { get{} }
ReadOnly Property TimedOut() As Boolean
Timeout virtual
The Timeout property specifies the maximum amout of time (in seconds) that a Connection will wait for incoming data within a single Receive operation. The timeout handling can be activated by the TimeoutEnabled property, the default value is 5 minutes.
property Timeout: Int32 read write;
Int32 Timeout { get; set; }
var Timeout: Int32 { get{} set{} }
Property Timeout() As Int32
TimeoutEnabled virtual
The TimeoutEnabled property toggles whether the Connection will do automatic timeout checking. When turned on (true), the Connection will keep track of the time that passes during any single Receive operation - if a receive operation takes longer than the given timeout, the connection will be terminated. The Timeout property controls the length of this timeout period. On Servers, TimeoutEnabled is set to true by default for security reasons. This will prevent malicious clients from opening connections and keeping them idling for long periods of time as parts of Denial of Service attacks.
property TimeoutEnabled: Boolean read write;
Boolean TimeoutEnabled { get; set; }
var TimeoutEnabled: Boolean { get{} set{} }
Property TimeoutEnabled() As Boolean
constructor (Binding)
constructor(binding: Binding)
Connection(Binding binding)
init(_ binding: Binding)
Sub New(binding As Binding)
Parameters:
- binding:
constructor (Socket)
constructor(socket: Socket)
Connection(Socket socket)
init(_ socket: Socket)
Sub New(socket As Socket)
Parameters:
- socket:
method BeginConnect(address: IPAddress; port: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginConnect(IPAddress address, Int32 port, AsyncCallback callback, Object state)
func BeginConnect(_ address: IPAddress, _ port: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginConnect(address As IPAddress, port As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- address:
- port:
- callback:
- state:
BeginConnect (EndPoint, AsyncCallback, Object): IAsyncResult virtual
method BeginConnect(endPoint: EndPoint; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginConnect(EndPoint endPoint, AsyncCallback callback, Object state)
func BeginConnect(_ endPoint: EndPoint, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginConnect(endPoint As EndPoint, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- endPoint:
- callback:
- state:
BeginInitializeServerConnection protected virtual
method BeginInitializeServerConnection(callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginInitializeServerConnection(AsyncCallback callback, Object state)
func BeginInitializeServerConnection(_ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginInitializeServerConnection(callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- callback:
- state:
BeginRead virtual
method BeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func BeginRead(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
BeginReadLine virtual
method BeginReadLine(callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginReadLine(AsyncCallback callback, Object state)
func BeginReadLine(_ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginReadLine(callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- callback:
- state:
BeginWrite virtual
method BeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func BeginWrite(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function BeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
BufferReadLine virtual
method BufferReadLine: String
String BufferReadLine()
func BufferReadLine() -> String
Function BufferReadLine() As String
Close override
Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.
method Close
void Close()
func Close()
Sub Close()
Connect (IPAddress, Int32) virtual
method Connect(address: IPAddress; port: Int32)
void Connect(IPAddress address, Int32 port)
func Connect(_ address: IPAddress, _ port: Int32)
Sub Connect(address As IPAddress, port As Int32)
Parameters:
- address:
- port:
Connect (EndPoint) virtual
Opens a connection to the target remote system.
method Connect(endPoint: EndPoint)
void Connect(EndPoint endPoint)
func Connect(_ endPoint: EndPoint)
Sub Connect(endPoint As EndPoint)
Parameters:
- endPoint:
CopyTo virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Copy the content of this stream to another
method CopyTo(Destination: Stream)
void CopyTo(Stream Destination)
func CopyTo(_ Destination: Stream)
Sub CopyTo(Destination As Stream)
Parameters:
- Destination:
DataSocketClose protected virtual
method DataSocketClose
void DataSocketClose()
func DataSocketClose()
Sub DataSocketClose()
DataSocketClose (Boolean) protected virtual
method DataSocketClose(dispose: Boolean)
void DataSocketClose(Boolean dispose)
func DataSocketClose(_ dispose: Boolean)
Sub DataSocketClose(dispose As Boolean)
Parameters:
- dispose:
DataSocketConnect protected virtual
method DataSocketConnect(endPoint: EndPoint)
void DataSocketConnect(EndPoint endPoint)
func DataSocketConnect(_ endPoint: EndPoint)
Sub DataSocketConnect(endPoint As EndPoint)
Parameters:
- endPoint:
DataSocketReceiveWhatsAvaiable protected virtual
method DataSocketReceiveWhatsAvaiable(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 DataSocketReceiveWhatsAvaiable(Byte[] buffer, Int32 offset, Int32 size)
func DataSocketReceiveWhatsAvaiable(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function DataSocketReceiveWhatsAvaiable(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
DataSocketSend protected virtual
method DataSocketSend(buffer: array of Byte): Int32
Int32 DataSocketSend(Byte[] buffer)
func DataSocketSend(_ buffer: Byte...) -> Int32
Function DataSocketSend(buffer As Byte()) As Int32
Parameters:
- buffer:
DataSocketSendAsMuchAsPossible protected virtual
method DataSocketSendAsMuchAsPossible(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 DataSocketSendAsMuchAsPossible(Byte[] buffer, Int32 offset, Int32 size)
func DataSocketSendAsMuchAsPossible(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function DataSocketSendAsMuchAsPossible(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
description override Toffee
func description() -> NSString
Disconnect virtual
Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.
method Disconnect
void Disconnect()
func Disconnect()
Sub Disconnect()
Dispose
method Dispose
void Dispose()
func Dispose()
Sub Dispose()
EndConnect virtual
method EndConnect(ar: IAsyncResult)
void EndConnect(IAsyncResult ar)
func EndConnect(_ ar: IAsyncResult)
Sub EndConnect(ar As IAsyncResult)
Parameters:
- ar:
EndInitializeServerConnection protected virtual
method EndInitializeServerConnection(ar: IAsyncResult)
void EndInitializeServerConnection(IAsyncResult ar)
func EndInitializeServerConnection(_ ar: IAsyncResult)
Sub EndInitializeServerConnection(ar As IAsyncResult)
Parameters:
- ar:
EndRead virtual
method EndRead(ar: IAsyncResult): Int32
Int32 EndRead(IAsyncResult ar)
func EndRead(_ ar: IAsyncResult) -> Int32
Function EndRead(ar As IAsyncResult) As Int32
Parameters:
- ar:
EndReadLine virtual
method EndReadLine(ar: IAsyncResult): String
String EndReadLine(IAsyncResult ar)
func EndReadLine(_ ar: IAsyncResult) -> String
Function EndReadLine(ar As IAsyncResult) As String
Parameters:
- ar:
EndWrite virtual
method EndWrite(ar: IAsyncResult)
void EndWrite(IAsyncResult ar)
func EndWrite(_ ar: IAsyncResult)
Sub EndWrite(ar As IAsyncResult)
Parameters:
- ar:
Flush override
method Flush
void Flush()
func Flush()
Sub Flush()
GetLength override
method GetLength: Int64
Int64 GetLength()
func GetLength() -> Int64
Function GetLength() As Int64
GetPosition override
method GetPosition: Int64
Int64 GetPosition()
func GetPosition() -> Int64
Function GetPosition() As Int64
Init virtual
method Init(socket: Socket)
void Init(Socket socket)
func Init(_ socket: Socket)
Sub Init(socket As Socket)
Parameters:
- socket:
InitializeServerConnection protected virtual
method InitializeServerConnection
void InitializeServerConnection()
func InitializeServerConnection()
Sub InitializeServerConnection()
IntBeginRead protected virtual
method IntBeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult IntBeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func IntBeginRead(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function IntBeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
IntBeginWrite protected virtual
method IntBeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult
IAsyncResult IntBeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
func IntBeginWrite(_ buffer: Byte..., _ offset: Int32, _ count: Int32, _ callback: AsyncCallback, _ state: Object) -> IAsyncResult
Function IntBeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult
Parameters:
- buffer:
- offset:
- count:
- callback:
- state:
IntEndRead protected virtual
method IntEndRead(ar: IAsyncResult): Int32
Int32 IntEndRead(IAsyncResult ar)
func IntEndRead(_ ar: IAsyncResult) -> Int32
Function IntEndRead(ar As IAsyncResult) As Int32
Parameters:
- ar:
IntEndWrite protected virtual
method IntEndWrite(ar: IAsyncResult)
void IntEndWrite(IAsyncResult ar)
func IntEndWrite(_ ar: IAsyncResult)
Sub IntEndWrite(ar As IAsyncResult)
Parameters:
- ar:
Read from this stream. Returns the nr of bytes retreived., or 0 when the end has been reached.
method Read(Buffer: array of Byte; Count: Int32): Int32
Int32 Read(Byte[] Buffer, Int32 Count)
func Read(_ Buffer: Byte..., _ Count: Int32) -> Int32
Function Read(Buffer As Byte(), Count As Int32) As Int32
Parameters:
- Buffer:
- Count:
The Read method is provided for compatibility with the Stream base class; it behaves identically to Receive. It will block until the entire buffer is filled or the connection has been closed.
method Read(buffer: array of Byte; offset: Int32; count: Int32): Int32
Int32 Read(Byte[] buffer, Int32 offset, Int32 count)
func Read(_ buffer: Byte..., _ offset: Int32, _ count: Int32) -> Int32
Function Read(buffer As Byte(), offset As Int32, count As Int32) As Int32
Parameters:
- buffer:
- offset:
- count:
ReadByte virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Reads a byte or returns -1 if the stream has reached the end
method ReadByte: Int32
Int32 ReadByte()
func ReadByte() -> Int32
Function ReadByte() As Int32
method ReadByte(out aResult: Byte): Boolean
Boolean ReadByte(out Byte aResult)
func ReadByte(_ aResult: inout Byte) -> Boolean
Function ReadByte(<OutAttribute> ByRef aResult As Byte) As Boolean
Parameters:
- aResult:
ReadGuid (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadGuid(out aResult: Guid): Boolean
Boolean ReadGuid(out Guid aResult)
func ReadGuid(_ aResult: inout Guid) -> Boolean
Function ReadGuid(<OutAttribute> ByRef aResult As Guid) As Boolean
Parameters:
- aResult:
ReadLine virtual
ReadLine will read data from the connection until a linebreak (either a CR LF or a single LF) is received.
If MaxLineLengthEnabled is active, ReadLine will take security precautions to ensure the remote side is not sending too long strings.
method ReadLine: String
String ReadLine()
func ReadLine() -> String
Function ReadLine() As String
ReadUInt16BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt16BE(out aResult: UInt16): Boolean
Boolean ReadUInt16BE(out UInt16 aResult)
func ReadUInt16BE(_ aResult: inout UInt16) -> Boolean
Function ReadUInt16BE(<OutAttribute> ByRef aResult As UInt16) As Boolean
Parameters:
- aResult:
ReadUInt16LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt16LE(out aResult: UInt16): Boolean
Boolean ReadUInt16LE(out UInt16 aResult)
func ReadUInt16LE(_ aResult: inout UInt16) -> Boolean
Function ReadUInt16LE(<OutAttribute> ByRef aResult As UInt16) As Boolean
Parameters:
- aResult:
ReadUInt32BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt32BE(out aResult: UInt32): Boolean
Boolean ReadUInt32BE(out UInt32 aResult)
func ReadUInt32BE(_ aResult: inout UInt32) -> Boolean
Function ReadUInt32BE(<OutAttribute> ByRef aResult As UInt32) As Boolean
Parameters:
- aResult:
ReadUInt32LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt32LE(out aResult: UInt32): Boolean
Boolean ReadUInt32LE(out UInt32 aResult)
func ReadUInt32LE(_ aResult: inout UInt32) -> Boolean
Function ReadUInt32LE(<OutAttribute> ByRef aResult As UInt32) As Boolean
Parameters:
- aResult:
ReadUInt64BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt64BE(out aResult: UInt64): Boolean
Boolean ReadUInt64BE(out UInt64 aResult)
func ReadUInt64BE(_ aResult: inout UInt64) -> Boolean
Function ReadUInt64BE(<OutAttribute> ByRef aResult As UInt64) As Boolean
Parameters:
- aResult:
ReadUInt64LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method ReadUInt64LE(out aResult: UInt64): Boolean
Boolean ReadUInt64LE(out UInt64 aResult)
func ReadUInt64LE(_ aResult: inout UInt64) -> Boolean
Function ReadUInt64LE(<OutAttribute> ByRef aResult As UInt64) As Boolean
Parameters:
- aResult:
Receive reads bytes from the connection. This function can be blocked to wait for additional incoming data.
method Receive(buffer: array of Byte): Int32
Int32 Receive(Byte[] buffer)
func Receive(_ buffer: Byte...) -> Int32
Function Receive(buffer As Byte()) As Int32
Parameters:
- buffer:
method Receive(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 Receive(Byte[] buffer, Int32 offset, Int32 size)
func Receive(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function Receive(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
ReceiveAllRemaining virtual
method ReceiveAllRemaining: array of Byte
Byte[] ReceiveAllRemaining()
func ReceiveAllRemaining() -> Byte...
Function ReceiveAllRemaining() As Byte()
method ReceiveAllRemaining(bufferSize: Int32): array of Byte
Byte[] ReceiveAllRemaining(Int32 bufferSize)
func ReceiveAllRemaining(_ bufferSize: Int32) -> Byte...
Function ReceiveAllRemaining(bufferSize As Int32) As Byte()
Parameters:
- bufferSize:
ReceiveToStream (Stream) virtual
method ReceiveToStream(stream: Stream)
void ReceiveToStream(Stream stream)
func ReceiveToStream(_ stream: Stream)
Sub ReceiveToStream(stream As Stream)
Parameters:
- stream:
method ReceiveToStream(stream: Stream; size: Int64)
void ReceiveToStream(Stream stream, Int64 size)
func ReceiveToStream(_ stream: Stream, _ size: Int64)
Sub ReceiveToStream(stream As Stream, size As Int64)
Parameters:
- stream:
- size:
method ReceiveToStream(stream: Stream; size: Int64; bufferSize: Int32)
void ReceiveToStream(Stream stream, Int64 size, Int32 bufferSize)
func ReceiveToStream(_ stream: Stream, _ size: Int64, _ bufferSize: Int32)
Sub ReceiveToStream(stream As Stream, size As Int64, bufferSize As Int32)
Parameters:
- stream:
- size:
- bufferSize:
ReceiveWhatsAvailable virtual
ReceiveWhatsAvailable reads bytes from the connection to fill the passed byte[] buffer. Unlike Receive, this function will not block to wait for additional incoming data, but return immediately with the data that was available.
method ReceiveWhatsAvailable(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 ReceiveWhatsAvailable(Byte[] buffer, Int32 offset, Int32 size)
func ReceiveWhatsAvailable(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function ReceiveWhatsAvailable(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
ResetStatistics virtual
method ResetStatistics
void ResetStatistics()
func ResetStatistics()
Sub ResetStatistics()
Seek override
method Seek(offset: Int64; origin: SeekOrigin): Int64
Int64 Seek(Int64 offset, SeekOrigin origin)
func Seek(_ offset: Int64, _ origin: SeekOrigin) -> Int64
Function Seek(offset As Int64, origin As SeekOrigin) As Int64
Parameters:
- offset:
- origin:
This method sends a block of data to the remote side.
method Send(buffer: array of Byte): Int32
Int32 Send(Byte[] buffer)
func Send(_ buffer: Byte...) -> Int32
Function Send(buffer As Byte()) As Int32
Parameters:
- buffer:
method Send(buffer: array of Byte; offset: Int32; size: Int32): Int32
Int32 Send(Byte[] buffer, Int32 offset, Int32 size)
func Send(_ buffer: Byte..., _ offset: Int32, _ size: Int32) -> Int32
Function Send(buffer As Byte(), offset As Int32, size As Int32) As Int32
Parameters:
- buffer:
- offset:
- size:
SendFromStream (Stream) virtual
method SendFromStream(stream: Stream)
void SendFromStream(Stream stream)
func SendFromStream(_ stream: Stream)
Sub SendFromStream(stream As Stream)
Parameters:
- stream:
method SendFromStream(stream: Stream; size: Int64)
void SendFromStream(Stream stream, Int64 size)
func SendFromStream(_ stream: Stream, _ size: Int64)
Sub SendFromStream(stream As Stream, size As Int64)
Parameters:
- stream:
- size:
method SendFromStream(stream: Stream; size: Int64; bufferSize: Int32)
void SendFromStream(Stream stream, Int64 size, Int32 bufferSize)
func SendFromStream(_ stream: Stream, _ size: Int64, _ bufferSize: Int32)
Sub SendFromStream(stream As Stream, size As Int64, bufferSize As Int32)
Parameters:
- stream:
- size:
- bufferSize:
SetPosition override virtual .NET, .NET Core 5.0, .NET Standard 2.0, Island
method SetPosition(value: Int64)
void SetPosition(Int64 value)
func SetPosition(_ value: Int64)
Sub SetPosition(value As Int64)
Parameters:
- value:
SkipBytes virtual
method SkipBytes(size: Int32)
void SkipBytes(Int32 size)
func SkipBytes(_ size: Int32)
Sub SkipBytes(size As Int32)
Parameters:
- size:
StartTimeoutTimer protected virtual
method StartTimeoutTimer
void StartTimeoutTimer()
func StartTimeoutTimer()
Sub StartTimeoutTimer()
StopTimeoutTimer protected virtual
method StopTimeoutTimer
void StopTimeoutTimer()
func StopTimeoutTimer()
Sub StopTimeoutTimer()
ToString virtual
method ToString: PlatformString
PlatformString ToString()
func ToString() -> String
Function ToString() As PlatformString
TriggerAsyncDisconnect protected virtual
method TriggerAsyncDisconnect
void TriggerAsyncDisconnect()
func TriggerAsyncDisconnect()
Sub TriggerAsyncDisconnect()
TriggerAsyncHaveIncompleteData protected virtual
method TriggerAsyncHaveIncompleteData
void TriggerAsyncHaveIncompleteData()
func TriggerAsyncHaveIncompleteData()
Sub TriggerAsyncHaveIncompleteData()
TriggerOnBytesReceived protected virtual
method TriggerOnBytesReceived(count: Int64)
void TriggerOnBytesReceived(Int64 count)
func TriggerOnBytesReceived(_ count: Int64)
Sub TriggerOnBytesReceived(count As Int64)
Parameters:
- count:
TriggerOnBytesSent protected virtual
method TriggerOnBytesSent(count: Int64)
void TriggerOnBytesSent(Int64 count)
func TriggerOnBytesSent(_ count: Int64)
Sub TriggerOnBytesSent(count As Int64)
Parameters:
- count:
method Write(Buffer: array of Byte): Int32
Int32 Write(Byte[] Buffer)
func Write(_ Buffer: Byte...) -> Int32
Function Write(Buffer As Byte()) As Int32
Parameters:
- Buffer:
Writes data to the stream.
method Write(Buffer: array of Byte; Count: Int32): Int32
Int32 Write(Byte[] Buffer, Int32 Count)
func Write(_ Buffer: Byte..., _ Count: Int32) -> Int32
Function Write(Buffer As Byte(), Count As Int32) As Int32
Parameters:
- Buffer:
- Count:
method Write(buffer: array of Byte; offset: Int32; count: Int32): Int32
Int32 Write(Byte[] buffer, Int32 offset, Int32 count)
func Write(_ buffer: Byte..., _ offset: Int32, _ count: Int32) -> Int32
Function Write(buffer As Byte(), offset As Int32, count As Int32) As Int32
Parameters:
- buffer:
- offset:
- count:
WriteByte virtual (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
Writes data to the stream.
method WriteByte(aValue: Byte)
void WriteByte(Byte aValue)
func WriteByte(_ aValue: Byte)
Sub WriteByte(aValue As Byte)
Parameters:
- aValue:
WriteGuid (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteGuid(value: Guid): Boolean
Boolean WriteGuid(Guid value)
func WriteGuid(_ value: Guid) -> Boolean
Function WriteGuid(value As Guid) As Boolean
Parameters:
- value:
WriteLine (String) virtual
The WriteLine method is similar to the Write method, but as in-parameter WriteLine it receives a string and finishes writing with carriage-return line feed character CRLF.
method WriteLine(line: String)
void WriteLine(String line)
func WriteLine(_ line: String)
Sub WriteLine(line As String)
Parameters:
- line:
method WriteLine(line: String; params args: array of Object)
void WriteLine(String line, params Object[] args)
func WriteLine(_ line: String, _ args: Object...)
Sub WriteLine(line As String, ParamArray args As Object())
Parameters:
- line:
- args:
WriteLineLF (String) virtual
The WriteLineLF method is similar to the Write method, but as in-parameter WriteLineLF it receives a string and finishes writing with line feed character CRLF.
method WriteLineLF(line: String)
void WriteLineLF(String line)
func WriteLineLF(_ line: String)
Sub WriteLineLF(line As String)
Parameters:
- line:
method WriteLineLF(line: String; params args: array of Object)
void WriteLineLF(String line, params Object[] args)
func WriteLineLF(_ line: String, _ args: Object...)
Sub WriteLineLF(line As String, ParamArray args As Object())
Parameters:
- line:
- args:
WriteUInt16BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt16BE(value: UInt16): Boolean
Boolean WriteUInt16BE(UInt16 value)
func WriteUInt16BE(_ value: UInt16) -> Boolean
Function WriteUInt16BE(value As UInt16) As Boolean
Parameters:
- value:
WriteUInt16LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt16LE(value: UInt16): Boolean
Boolean WriteUInt16LE(UInt16 value)
func WriteUInt16LE(_ value: UInt16) -> Boolean
Function WriteUInt16LE(value As UInt16) As Boolean
Parameters:
- value:
WriteUInt32BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt32BE(value: UInt32): Boolean
Boolean WriteUInt32BE(UInt32 value)
func WriteUInt32BE(_ value: UInt32) -> Boolean
Function WriteUInt32BE(value As UInt32) As Boolean
Parameters:
- value:
WriteUInt32LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt32LE(value: UInt32): Boolean
Boolean WriteUInt32LE(UInt32 value)
func WriteUInt32LE(_ value: UInt32) -> Boolean
Function WriteUInt32LE(value As UInt32) As Boolean
Parameters:
- value:
WriteUInt64BE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt64BE(value: UInt64): Boolean
Boolean WriteUInt64BE(UInt64 value)
func WriteUInt64BE(_ value: UInt64) -> Boolean
Function WriteUInt64BE(value As UInt64) As Boolean
Parameters:
- value:
WriteUInt64LE (declared in Stream) .NET, .NET Standard 2.0, Island, Toffee
method WriteUInt64LE(value: UInt64): Boolean
Boolean WriteUInt64LE(UInt64 value)
func WriteUInt64LE(_ value: UInt64) -> Boolean
Function WriteUInt64LE(value As UInt64) As Boolean
Parameters:
- value:
AsyncDisconnect
event AsyncDisconnect: EventHandler
delegate EventHandler AsyncDisconnect()
__event EventHandler: AsyncDisconnect!
Event AsyncDisconnect As EventHandler
AsyncHaveIncompleteData
event AsyncHaveIncompleteData: EventHandler
delegate EventHandler AsyncHaveIncompleteData()
__event EventHandler: AsyncHaveIncompleteData!
Event AsyncHaveIncompleteData As EventHandler
OnBytesReceived
event OnBytesReceived: EventHandler
delegate EventHandler OnBytesReceived()
__event EventHandler: OnBytesReceived!
Event OnBytesReceived As EventHandler
OnBytesSent
event OnBytesSent: EventHandler
delegate EventHandler OnBytesSent()
__event EventHandler: OnBytesSent!
Event OnBytesSent As EventHandler