CiucaS
CiucaS

Reputation: 2128

Network problems while using Indy

function UploadToFTP(file: string ; PathSrv : string): Boolean;
var 
  server, port, user , password: string;
  SR : TSearchRec;
begin
  Result := True;
  FEventLogger := TEventLogger.Create('Upload FTP');
  if file <> '' then
  begin
    try
            server := FServer;
            port := FPort;
            user := FUserName;
            password:= FPassword;
            FindFirst(file, faArchive, SR);
            try   // try except
                idftp1.Host:= server;
                idftp1.Port := StrToInt(port);
                idftp1.Username:= user;
                idftp1.Password:= password;
                idftp1.Connect();
                idftp1.Put(file,PathSrv+SR.Name);
            except on E: Exception do   begin
                Result:= False;
                FEventLogger.LogMessage('Exception : ' + E.Message , EVENTLOG_ERROR_TYPE , 0, 2);
                WriteToLog('Exception: '+ file+' error message: '+  E.Message);
             end;
           end;
    finally

    end;
  end;  
end;

So I have this function that does an ftp upload to some large files on sometimes slow networks. I've tested it localy and it works ok, but on slow networks i get this eror in 99% of the time.

The specified network name is no longer available.

This is a very strange behavior, becouse the FTP is located on a server that has no disconnecting issues. I also try to watch, and it start the file upload and it does almost all the upload before throwing this error. So for example if I have a 100MB file it does 99MB of the upload then throws the error.

Any ideas what is causing this error or what can I do?

Also from time to time I have an other error

Socket Error # 10054

Connection reset by peer.

To mention,i've tried to upload this files using filezilla and it works, so the problem is somewhere in that code, I might miss something.

Upvotes: 0

Views: 753

Answers (1)

user1803300
user1803300

Reputation:

Are you using Symantec Endpoint Protection or KIS (Kaspersky Internet Security) ? Take a look here, here and here.

The "The specified network name is no longer available." is caused by Symantec Endpoint Protection 11.0, Symantec has identified this as a known issue.

Btw, in your code don't forget to call .Disconnect() after you're finished uploading the file.

Upvotes: 1

Related Questions