소스를 보건데..
컨넥션 후 곧바로 파일을 다운하려고 할 때 발생하는 듯 합니다..
즉, Connect 함수가 실행되더라도..
파일입출력할 준비가 완료된 시점이 아닌 경우라는 것이지요..
해당 콤포넌트에 OnConnected와 같은 이벤트가 있다면..
그 이벤트 안에서 파일을 다운 받을 수 있도록 하시기 바랍니다..
바다야 님이 쓰신 글 :
: 안녕하세요.
: 이틀이면 추석이네요.. 즐거운 추억보내세요.
:
: 현재의 방법으로 클라이언트에서 자료를 만들어서 nt서버로 ftp을 사용하여
: 자료는 올라가고 있는데 문제는 OpenDialog 박스을 사용 안하고 하는 방법이 없나요???
: 현재 프로그램에서 직접파일을 생성하고 QReport파일을 만들어서 두개을 자동적으로 올리는 방법입니다.
:
: 만약에, OpenDialog1.Execute; 이 문장을 제외하여 실행하면
: Ftp1.Type_(2); 이 문장에서 에라가 발생하네요.
: 그리고, Ftp1.Type_(3); 로 변경을 하여도 현상은 같습니다.
:
: <메세지1>
: Project Form1.exe raised exception class EOleException with message
: "Wrong protocol or connection state for the requested transaction or request'.
: Process stopped.
: Use Step or Run to continue.
:
: <메세지2>
: Wrong protocol or connection state for the requested transaction or request.
:
:
: var
: gNowBusy : boolean; /전역변수
:
: procedure TForm1.P_SAVE;
: begin
: if FTP1.State = prcConnected then begin
: FTP1.Quit;
: Application.ProcessMessages;
: end;
: FTP1.Connect(FTP1.RemoteHost, FTP1.RemotePort);
:
: OpenDialog1.Execute; //이 문장이 없으면 에라가 발생함
: Ftp1.Type_(2);
:
: Application.ProcessMessages;
: FTP1.PutFile('QReport1.htm', 'QReport1.htm');
: while gNowBusy do application.ProcessMessages;
: FTP1.PutFile('QReport1.txt', 'QReport1.txt');
: end;
:
: procedure TForm1.FTP1Busy(Sender: TObject; isBusy: WordBool);
: begin
: if isBusy then begin
: Screen.Cursor := crHourGlass;
: gNowBusy := true;
: end else begin
: Screen.Cursor := crDefault;
: gNowBusy := false;
: end;
: end;
:
: procedure TForm1.FTP1ProtocolStateChanged(Sender: TObject;
: ProtocolState: Smallint);
: begin
: case Protocolstate of
: Ftpauthentication: Ftp1.Authenticate(FTP1.Userid, FTP1.Password);
: end;
: end;
|