BCB6 w/ Indy 9: Connection Problems

Giganews Newsgroups
Subject: BCB6 w/ Indy 9: Connection Problems
Posted by:  poojo hackma (poojo.com/mail)
Date: Tue, 28 Feb 2006

I replaced some PostMessage routines with SendMessage routines in my FTP
code, but now I am unable to connect.  Stepping through the code below, Line
86 immediately throws me to Line 104 where I receive an
EIdProtocolReplyError with the message "Microsoft FTP Service".  After
stepping over this, Line 86 throws the same EIdProtocolReplyError exception
except this time the message is "Please login with USER and PASS".

I have *not* changed the username or password.  I checked them with the
debugger at run time, and they are correct.

Why do I get this error?

(mFtp is the Indy component)

75:
//---------------------------------------------------------------------------
76: void ZFtpThread::Connect(char* host, char* user, char* pwd, unsigned ms)
{
77:  mFtp->Host = host;
78:  mFtp->Username = user;
79:  mFtp->Password = pwd;
80:  mFtp->ReadTimeout = ms; // timeout in milliseconds
81:  try {
82:    if (mFtp->Connected()) {
83:      Quit(); // not the same as mFtp->Quit();
84:      aSysInfo = "Off-Line";
85:    } else {
86:      mFtp->Connect(true);
87:      if (mFtp->Connected() == false) {
88:        MessageLog("No connection to server.");
89:      } else {
90:        aSysInfo = mFtp->SystemDesc;
91:        List(hMain);
92:      }
93:    }
94:  } catch (Exception* ex) {
95:    PostMessage(hMain, FTH_CLOSE, true,
reinterpret_cast<int>(ex->Message.c_str()));
96:  }
97:  SendMessage(hMain, FTH_CONNECT, 0,
reinterpret_cast<int>(aSysInfo.c_str()));
98: }
99:
//---------------------------------------------------------------------------
100: void ZFtpThread::CWD(AnsiString &v) {
101:  if (!mFtp->Connected()) return;
102:  AnsiString curDir;
103:  try {
104:    curDir = mFtp->RetrieveCurrentDir();
105:  } catch (Exception* ex) {
106:    PostMessage(hMain, FTH_CLOSE, true,
reinterpret_cast<int>(ex->Message.c_str()));
107:  }
108:  if (v != NULL)
109:    v = curDir;
110: }
111:
//---------------------------------------------------------------------------

Replies