Ends a call to BeginDereferenceLink
Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461
Syntax
C# |
---|
public FtpListItem EndDereferenceLink(
IAsyncResult ar
) |
Visual Basic |
---|
Public Function EndDereferenceLink (
ar As IAsyncResult
) As FtpListItem |
Visual C++ |
---|
public:
FtpListItem^ EndDereferenceLink(
IAsyncResult^ ar
) |
Return Value
Type:
FtpListItemFtpListItem, null if the link can't be dereferenced
Examples
C# |
Copy
|
using System;
using System.Net;
using System.Threading;
using System.Net.FtpClient;
namespace Examples {
static class BeginDereferenceLink {
static ManualResetEvent m_reset = new ManualResetEvent(false);
public static void BeginDereferenceLinkExample(FtpListItem item) {
using (FtpClient conn = new FtpClient()) {
m_reset.Reset();
conn.Host = "localhost";
conn.Credentials = new NetworkCredential("ftptest", "ftptest");
conn.Connect();
if (item.Type == FtpFileSystemObjectType.Link && item.LinkTarget != null) {
conn.BeginDereferenceLink(item, new AsyncCallback(DereferenceLinkCallback), conn);
m_reset.WaitOne();
}
conn.Disconnect();
}
}
static void DereferenceLinkCallback(IAsyncResult ar) {
FtpClient conn = ar.AsyncState as FtpClient;
FtpListItem target;
try {
if (conn == null)
throw new InvalidOperationException("The FtpControlConnection object is null!");
target = conn.EndDereferenceLink(ar);
if (target != null) {
}
}
catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
finally {
m_reset.Set();
}
}
}
}
|
See Also