CSReportWebServer.NativeMessaging.Port.BeginRead C# (CSharp) Метод

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

Begins a native message asynchronous read from the input stream.
The input stream IO exception. The input stream was closed. The input stream does not support read operation.
public BeginRead ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback An AsyncCallback delegate that is executed when a native message is read or an error has occured.
state object An user-defined object that is passed to the callback inside its IAsyncResult parameter.
Результат IAsyncResult
        public IAsyncResult BeginRead(AsyncCallback callback, object state)
        {
            AsyncResult ar = new AsyncResult(this, callback, state);
            ar.lengthBuffer = new byte[4];
            ar.lengthOffset = 0;
            istream.BeginRead(
                ar.lengthBuffer,
                ar.lengthOffset,
                ar.lengthBuffer.Length - ar.lengthOffset,
                delegate (IAsyncResult _ar) { ((AsyncResult)_ar.AsyncState).port.ReadLengthCallback((AsyncResult)_ar.AsyncState, _ar); },
                ar);
            return ar;
        }