1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
using (AnonymousPipeServerStream pipein = new AnonymousPipeServerStream(PipeDirection.In))
{
using (AnonymousPipeClientStream pipeout = new AnonymousPipeClientStream(PipeDirection.Out,
pipein.GetClientHandleAsString()))
{
byte[] res;
Thread t = new Thread(() =>
{
using (MemoryStream x = new MemoryStream())
{
pipein.CopyTo(x);
res = x.ToArray();
}
});
t.Start();
using (SftpFileStream pin = client.OpenRead("/toto/fichier.txt"))
{
pin.CopyTo(pipeout);
}
t.Join();
}
} |
Partager