I keep getting an exception "Failed to accept connection within timeout period (0)"
System.IO.IOException was unhandled
Message="Failed to accept connection within timeout period (0)"
Source="edtFTPnet"
StackTrace:
at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile)
at EnterpriseDT.Net.Ftp.FTPClient.Get(String localPath, String remoteFile)
at EnterpriseDT.Net.Ftp.FTPConnection.DownloadFile(String localPath, String remoteFile)
at WindowsApplication1.Form1.button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Wyatt\My Documents\Visual Studio 2005\Projects\Message\Message\Form1.cs:line 46
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsApplication1.Program.Main() in C:\Documents and Settings\Wyatt\My Documents\Visual Studio 2005\Projects\Message\Message\Program.cs:line 18
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The field Message is in this format "1234567890/1234567890_20060823-041830PM.wav"
On the FTP server is the dir "1234567890" with a filename "1234567890_20060823-041830PM.wav" in it
My code is as follows
while (rs.Read())
{
string HoldMessage = rs["Message"] + "";
string FullPath = @"c:/recordings/" + HoldMessage;
string DirName = HoldMessage.Substring(0, 10);
string MessageName = FullPath.Substring(25, 32);
if (!File.Exists(FullPath))
{
ftp.Connect();
ftp.ChangeWorkingDirectory(DirName);
rtbText.Text = rtbText.Text + MessageName + "...Getting\n";
ftp.DownloadFile(FullPath, MessageName);
ftp.Close();
rtbText.Text = rtbText.Text + MessageName + "...Done\n";
}
}
rs.Close();
TBCConnection.Close();
rtbText.Text = rtbText.Text + "Finished\n";
Any help would be appreciated.