public byte[] RequestOpenDir(string path, bool nullOnError = false)
{
SshException exception = null;
byte[] handle = null;
using (var wait = new AutoResetEvent(false))
{
var request = new SftpOpenDirRequest(ProtocolVersion, NextRequestId, path, Encoding,
response =>
{
handle = response.Handle;
wait.Set();
},
response =>
{
exception = GetSftpException(response);
wait.Set();
});
SendRequest(request);
WaitOnHandle(wait, OperationTimeout);
}
if (!nullOnError && exception != null)
{
throw exception;
}
return handle;
}