ReceiveHandler Class
[C++]
class ReceiveHandler : public HandlerBase (.. public RefCountable, public NoCopy)
{
public:
bool Success() const;
bool StdErr() const;
bool Eof() const;
unsigned char const* GetDataPtr() const;
unsigned int GetDataSize() const;
protected:
virtual void OnStart();
virtual void OnDone();
virtual void OnReceive(bool stdErr, unsigned char const* dataPtr, unsigned int dataSize, bool eof);
virtual void OnError();
}
[C#]
public class ReceiveHandler : IDisposable, HandlerBase (.. WaitImpl)
{
public bool Success { get; }
public bool StdErr();
public bool Eof();
public byte[] GetData();
public event StartEventHandler OnStart;
public event DoneEventHandler OnDone;
public event ReceiveEventHandler OnReceive;
public event ReceiveErrorEventHandler OnError;
public override sealed bool IsDisposed { get; }
public override sealed void Dispose();
}
Members
General
- Success: Request completed successfully?
- StdErr: Are we receiving data for the stdout or stderr stream?
- Eof: If eof=true (end-of-file), the server will send no more data over this channel. The client usually just replies with an EOF of its own, although it could still send data to the server as long as the channel is open.
- [C++] GetDataPtr: Returns a pointer to an array of type unsigned char (=byte) that contains the received data.
- [C++] GetDataSize: Number of bytes in the array.
- [.NET] GetData: Returns an array of type Byte that contains the received data.
Overrides and Events
- OnStart: The first override/event being invoked for a request. *
- OnDone: The last override/event being invoked for a request. *
- OnReceive: Invoked to pass the received data to you.
Parameters:- stdErr: See StdErr().
- [C++] dataPtr: See GetDataPtr().
- [C++] dataSize: See GetDataSize().
- [.NET] data: See GetData().
- eof: See Eof().
- OnError: Invoked when the associated channel is or gets closed.
[.NET] Disposing
- IsDisposed: Is the object disposed?
- Dispose: Release all resources used by the object.
Remarks
ReceiveHandler is a base class which must be derived to use. Either derive and implement your own OnDone() method, or use pre-made derived classes ReceiveEvent or ReceiveMsg (for Win32 graphical applications). If you use ReceiveEvent, call WaitDone() or wait for GetDoneEvent() before checking the result.
This handler is used with the [ClientSessionChannel]Receive request.
* [C++] Always call the base class implementation from your override.