[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: SV: FTPAPI FTP_exitproc



Thanks Scott, I'll do some testing with this.

Brgds
Helge
 

-----Oprindelig meddelelse-----
Fra: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] På vegne af Scott Klement
Sendt: 12. februar 2014 23:45
Til: HTTPAPI and FTPAPI Projects
Emne: Re: SV: FTPAPI FTP_exitproc

Helge,

destroySession() is only for internal use, you cannot call it from outside
of FTPAPI, and it would not help you even if it did.

The problem is that you are changing the _default_ for new sessions.  So
destroying one session would not stop it from being the default for
subsequent sessions.

At least in my copy of FTPAPI, FTP_open() only _connects_ the socket, it
does not read the response message from the server.  That part is handled by
FTP_login(), so if you call these procedures separately, you should indeed
get the "220" message that you cite passed to your exit procedure.

However, if all else fails, another way to do this is to call
FTP_xproc() prior to FTP_Open.  This will set an exit procedure for _all_
sessions, and therefore can be called before you know the 
session/socket number.   Then, subsequently, you can call FTP_xproc() 
again and pass *NULL for the procedure.  This will eliminate the procedure
from being called again later.

-SK


On 2/12/2014 4:10 PM, Helge Bichel wrote:
> Hi Scott.
>
> I had the split of FTP_Conn into FTP_Open and FTP_login in mind but 
> then I miss the connection feedback:
>    Connecting to host xxx.xxx.xxx.xxx at address xxx.xxx.xxx.xxx using 
> port 21.
>    220 <<<Connect:Enterprise UNIX 2.4.04 Build 134 >>> at espdev01 FTP 
> server ready. Time = 07:19:29 being important for proofing the 
> connection done.
>
> I saw in your FTPAPI internal procedures a destroySession() (in source 
> FTPAPISSN).
> Could this one be used to do a reset when FTP_Conn or FTP_Open fails ?
>
> Brgds
> Helge
>
>
>
> -----Oprindelig meddelelse-----
> Fra: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] På vegne af Scott 
> Klement
> Sendt: 12. februar 2014 22:42
> Til: HTTPAPI and FTPAPI Projects
> Emne: Re: FTPAPI FTP_exitproc
>
> Helge,
>
> Yes, this is the expected behavior.  when you register an exitProc 
> with FTP_DEFAULT_SOCKET it will apply to all new connections that are
created
> thereafter.    Unless this is what you want, you should not use the
> FTP_DEFAULT_SOCKET.
>
> FTP_Conn() has actually been split into two separate procedures for 
> exactly this reason.  The new procedures are FTP_Open() which 
> establishes the socket number, and FTP_Login() which does the login
portion of the FTP protocol.
> In current versions of FTPAPI, FTP_Conn() actually just calls these 
> two procedures in succession.
>
> So you should change your code to:
>
> FtpSess  = FTP_Open(FtpRmtSys: FTPPort: FTPCnnTio);
>
> FTP_exitProc( FtpSess: FTP_EXTLOG: %paddr(FTPExitProc): 
> %addr(LastMsg));
>
> if FTP_Login( FtpSess: FtpUsr: FtpPwd ) < 0;
>       // error occurred.
> endif;
>
> Now the exit procedure will only fire for this particular session, and 
> will not apply to any others.
>
> You'll want to call FTP_Quit() when this FTP session is done (unless 
> FTP_open failed for some reason.)
>
>
>
> On 2/12/2014 8:53 AM, Helge Bichel wrote:
>>      Dear Group.
>>
>>
>>      I have some problems getting the FTP_exitproc working across FTP
>>      session within the same 5250 session.
>>
>>
>>      Having:
>>
>>      (1)          FTP_exitProc( FTP_DEFAULT_SOCKET   : FTP_EXTLOG   :
>>      %paddr(FTPExitProc) : %addr(LastMsg) );
>>
>>      (1)          FtpSess =
>>      FTP_Conn(FtpRmtSys:FtpUsr:FtpPwd:FTPPort:FTPCnnTio);
>>
>>
>>      Starting the  FTP_exitproc with FTP_DEFAULT_SOCKET before FTP_conn
is
>>      for getting the connection message from the FTP server
>>
>>                      Connecting to host xxx.xxx.xxx.xxx at address
>>      xxx.xxx.xxx.xxx using port 21.
>>
>>                      220 <<<Connect:Enterprise UNIX 2.4.04 Build 134 >>>
at
>>      espdev01 FTP server ready. Time = 07:19:29
>>
>>                      > USER
>>      yyyyyyyy
>>
>>                      331 Password required for
>>      yyyyyyyy
>>
>>                      > PASS
>>      **********
>>
>>                      230 Connect:Enterprise UNIX login ok, access
>>      restrictions apply.
>>
>>
>>      this would be missing if I used
>>
>>      (2)          FtpSess =
>>      FTP_Conn(FtpRmtSys:FtpUsr:FtpPwd:FTPPort:FTPCnnTio);
>>
>>      (2)          FTP_exitProc( FtpSess   :  FTP_EXTLOG    :
>>      %paddr(FTPExitProc) : %addr(LastMsg) );
>>
>>
>>      Now the problem:
>>
>>
>>      Calling MyFTPPgmA
>>
>>      Using (1) causes problems if the FTP_Conn for some reason (server
not
>>      available, invalid pw etc.)  fails.
>>
>>      The FTP_exitporoc is set at this time and does not get 'cleared'.
>>
>>      I think this is because I can't do a FTP_Quit since the session
isn't
>>      established.
>>
>>
>>      Calling MyFTPPgmB
>>
>>      While still in the same 5250 session I call a different program
using
>>      the same setup (1) and connecting to another FTP server.
>>
>>      MyFTPPgmB crashes when doing the FTP_Conn. Reason is the
FTP_exitproc
>>      still pointing to the routine set by MyFTPPgmA.
>>
>>      The FTPExitProc in MyFTPPgmA writes to a file  A and  this routine
>>      still is in effect when running MyFTPPgmB.
>>
>>      The required file A isn't open since MyFTPPgmB uses file B, not A..
>>
>>
>>      To summarize the problem:
>>
>>
>>      The FTP_exitproc set in one program 'hangs' when not doing a
FTP_Quit
>>      and that's seems not to be possible to do when FTP_Conn fails.
>>
>>
>>      Hoping for a wise solution.
>>
>>
>>      Best regards
>>
>>      Helge
>>
>>
>>
>> ---------------------------------------------------------------------
>> -- This is the FTPAPI mailing list.  To unsubscribe, please go to:
>> http://www.scottklement.com/mailman/listinfo/ftpapi
>> ---------------------------------------------------------------------
>> --
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -
>

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------