PowerTCP Mail for .NET
ReadAsync Method




The byte array used to store the received data.
The position in the buffer to store the data.
The maximum number of bytes to receive.
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
Object to pass into the callback method when the operation completes; can be null.
Start an asynchronous read on the socket.
Syntax
Public Sub ReadAsync( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer, _
   ByVal callback As TcpAsyncCallback, _
   ByVal state As Object _
) 
Dim instance As TcpBase
Dim buffer() As Byte
Dim offset As Integer
Dim count As Integer
Dim callback As TcpAsyncCallback
Dim state As Object
 
instance.ReadAsync(buffer, offset, count, callback, state)
public void ReadAsync( 
   byte[] buffer,
   int offset,
   int count,
   TcpAsyncCallback callback,
   object state
)
public: void ReadAsync( 
   byte[]* buffer,
   int offset,
   int count,
   TcpAsyncCallback* callback,
   Object* state
) 
public:
void ReadAsync( 
   array<byte>^ buffer,
   int offset,
   int count,
   TcpAsyncCallback^ callback,
   Object^ state
) 

Parameters

buffer
The byte array used to store the received data.
offset
The position in the buffer to store the data.
count
The maximum number of bytes to receive.
callback
A TcpAsyncCallback delegate referencing the method to invoke on an IO completion thread when the operation completes.
state
Object to pass into the callback method when the operation completes; can be null.
Remarks
The TCP component is typically used by making blocking calls on a worker (non-UI) thread. This technique keeps development simple as there is no need for saving state information, but does require a dedicated thread for each connection. If a dedicated worker thread for each socket is not scalable enough, such as in server applications, developers can instead use the Async methods which utilize IO completion ports. The Async methods do not require a dedicated worker thread for each connection, and the specified callback is invoked on an IO completion thread when the operation completes. This is the best way to create a high-performance server without using dedicated worker threads.
See Also

Reference

TcpBase Class
TcpBase Members


PowerTCP Mail for .NET Documentation Version 4.3
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic