Opens a stream to the file specified by the URI
Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461
Syntax
C# |
---|
public static Stream OpenRead(
Uri uri,
bool checkcertificate
) |
Visual Basic |
---|
Public Shared Function OpenRead (
uri As Uri,
checkcertificate As Boolean
) As Stream |
Visual C++ |
---|
public:
static Stream^ OpenRead(
Uri^ uri,
bool checkcertificate
) |
Parameters
- uri
- Type: System..::..Uri
FTP/FTPS URI pointing at a file
- checkcertificate
- Type: System..::..Boolean
Indicates if a ssl certificate should be validated when using FTPS schemes
Return Value
Type:
StreamStream object
Examples
C# |
Copy
|
using System;
using System.IO;
using System.Net.FtpClient;
namespace Examples {
public static class OpenReadURI {
public static void OpenURI() {
using (Stream s = FtpClient.OpenRead(new Uri("ftp://server/path/file"))) {
byte[] buf = new byte[8192];
int read = 0;
try {
while ((read = s.Read(buf, 0, buf.Length)) > 0) {
Console.Write("\r{0}/{1} {2:p} ",
s.Position, s.Length,
((double)s.Position / (double)s.Length));
}
}
finally {
Console.WriteLine();
s.Close();
}
}
}
}
}
|
See Also