Back to FlowSsh Documentation

ReceiveHandler Class

[C++]

class ReceiveHandler : public RefCountable, public NoCopy, public HandlerBase
{
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 (.. : 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.
  • [Cpp] GetDataPtr: Returns a pointer to an array of type unsigned char (=byte) that contains the received data.
  • [Cpp] 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().
    • [Cpp] dataPtr: See GetDataPtr().
    • [Cpp] 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

This handler is used with the [ClientSessionChannel]Receive request.

* [Cpp] Always call the base class implementation from your override.