Home > multiple_sessions  [1 example]

Multiple sessions connected to different remote servers.

 Examples

Ex. 1.  example of multiple f sessions open at one time.

SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid1 VARCHAR2(80);
  host1 VARCHAR2(80)   := 'ftp.gnu.org';
  usernm1 VARCHAR2(80) := 'anonymous';
  passwd1 VARCHAR2(80) := '';
  fid2 VARCHAR2(80);
  host2 VARCHAR2(80)   := 'ftp.mcafee.com';
  usernm2 VARCHAR2(80) := 'anonymous';
  passwd2 VARCHAR2(80) := '';
BEGIN
  fid1 := fclient_p.createFTPClient;
  fid2 := fclient_p.createFTPClient;

  fclient_p.setDebugger(fid1, 1);
  fclient_p.setDebugger(fid2, 1);

  fclient_p.login(fid1, host1, usernm1, passwd1);
  fclient_p.login(fid2, host2, usernm2, passwd2);

  DBMS_OUTPUT.PUT_LINE(SUBSTR('Last Message: '||fclient_p.getLastDebugMessage(fid1), 1, 255));
  DBMS_OUTPUT.PUT_LINE(SUBSTR('Last Message: '||fclient_p.getLastDebugMessage(fid2), 1, 255));

  fclient_p.logout(fid1);
  fclient_p.logout(fid2);

  FOR i IN 0..fclient_p.getTotalDebugMessages(fid1)-1 LOOP
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getDebugMessageAt(fid1, i), 1, 255));
  END LOOP;

  FOR i IN 0..fclient_p.getTotalDebugMessages(fid2)-1 LOOP
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getDebugMessageAt(fid2, i), 1, 255));
  END LOOP;
  
  fclient_p.remove(fid1);
  fclient_p.remove(fid2);
EXCEPTION
  WHEN fclient_p.java_failed THEN
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid1), 1, 255));
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid2), 1, 255));
END;
/

Output: Last Message: received response: 230-If you have any problems with the GNU software or its downloading, 230-please refer your questions to . 230- 230-There are several mirrors of this archive, a complete list can be 230-found on http://www.gn Last Message: received response: 230-You are connected to ftp.nai.com. 230-Your use is subject to the terms and 230-conditions in Legal.TXT and Usage.TXT files. 230-*Mirror sites at FTPEUR.NAI.COM and FTPDE.NAI.COM* 230 Anonymous use received response: 220 GNU FTP server ready. sending command: USER anonymous received response: 331 Please specify the password. sending command: PASS null received response: 230-If you have any problems with the GNU software or its downloading, 230-please refer your questions to . 230- 230-There are several mirrors of this archive, a complete list can be 230-found on http://www.gnu.org/order/ft sending command: QUIT received response: 221 Goodbye. received response: 220 sncwebftp5 Microsoft FTP Service (Version 5.0). sending command: USER anonymous received response: 331 Anonymous access allowed, send identity (e-mail name) as password. sending command: PASS null received response: 230-You are connected to ftp.nai.com. 230-Your use is subject to the terms and 230-conditions in Legal.TXT and Usage.TXT files. 230-*Mirror sites at FTPEUR.NAI.COM and FTPDE.NAI.COM* 230 Anonymous user logged in. sending command: QUIT received response: 221 Thanks for using ftp.nai.com!

 Related Commands
 bye
 login
 
© 1999-2003 Bear Claw Inc.