Help! Using indy ftp in windows service

Giganews Newsgroups
Subject: Help! Using indy ftp in windows service
Posted by:  xiaoyvr (xiaoy…@gmail.com)
Date: Mon, 30 Apr 2007

Hi

I am using indy10 in .net2005.

Writing a windows service.

code:
            Indy.Sockets.FTP ftp = new Indy.Sockets.FTP();

            try
            {

                Uri u = new Uri("ftp://21.244.4.213/tmp/");

                ftp.Host = u.Host;
                ftp.Username = "renyi";
                ftp.Password = "renyi";
                ftp.Connect();

                ftp.ChangeDir(u.LocalPath);

                ftp.Get(filename, LocalPath + filename, true, false);

                return true;
            }
            catch (Indy.Sockets.EIdReplyRFCError rex)
            {
                _log.Error(filename, rex);

                if (rex.ErrorCode == 550)
                {
                    // file is not ready, download another.

                    ... ...

I test the code in a windows app, passed.

But in a windows service app, It blocked at
    ftp.Get(filename, LocalPath + filename, true, false);

for a long long ..... time.

Someone please tell me how to fix it.

Replies