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

RE: Intercepting FTP get error



What does your code look like for the FTP? Most of the commands that "do something" return a code which you should check. Do you have error handling in your program? What is it doing? Maybe you trapped the error but didn't do anything with it?

Or are you saying you have code and it wasn't triggered? Or did your program continue to wait indefinitely without an error?

If the first, this example (EX3GET) displays a message which you would find on qsysopr if run in batch. You could add any special error handling inside that error block.

c                   if        ftp_get(ftp: 'fips.exe': '/fips.exe') < 0
c                   eval      Msg = ftp_errorMsg(ftp)
c                   dsply                   Msg
c                   callp     ftp_quit(ftp)
c                   eval      *inlr = *on
c                   return
c                   endif

If the latter, yes you should add timeout to the procedure. In February 2007, there was a discussion about the timeout. It starts here:
http://www.scottklement.com/archives/ftpapi/200702/msg00018.html

The answer said to do this...
Add the timeout on the connection command and then it will be used by the rest of the routines.

fd = ftp_conn('ftp.freebsd.com':
              'anonymous':
              'bgates@xxxxxxxxxxxxx':
               FTP_PORT:
               120)      <===== This is the timeout on the connection


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Martina Carolina Alagna
Sent: Thursday, January 03, 2013 8:03 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: R: Intercepting FTP get error

Hello Scott,

The data connection works properly most of the time; since the error doesn't happen on a regular base and is a very rare event, what I need is a way to intercept the error at run time, whenever it occurs.

I wonder if there is a way to intercept the error in the procedure, in order to avoid for the client (AS400 program) to remain idle.


Cordialmente
______________________________________________
Martina Alagna
ArtMatica Italia srl

uff.  06.4060.667
cell. 348-0341087 e-mail m.alagna@xxxxxxxxxxxx
http://www.artmatica.it
 "Rispetta il tuo ambiente, pensa prima di stampare questa e-mail"
" Please consider your environmental responsibility before printing this e-mail



-----Messaggio originale-----
Da: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Per conto di ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx
Inviato: mercoledì 2 gennaio 2013 18:05
A: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Oggetto: Ftpapi Digest, Vol 75, Issue 1
Send Ftpapi mailing list submissions to
        ftpapi@xxxxxxxxxxxxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        http://scottklement.com/mailman/listinfo/ftpapi
or, via email, send a message with subject or body 'help' to
        ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx

You can reach the person managing the list at
        ftpapi-owner@xxxxxxxxxxxxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific than "Re: Contents of Ftpapi digest..."


Today's Topics:

   1. Help - ftp - get error (Martina Carolina Alagna)
   2. Re: Help - ftp - get error (Scott Klement)
   3. AUTO: Thomas Raddatz/GfD/DE ist au?er Haus. (R?ckkehr am
      07.01.2013) (thomas.raddatz@xxxxxx)
   4. SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system
      state (PReid@xxxxxxxxxxxx)
   5. SV: SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system
      state (Magne Kofoed)


----------------------------------------------------------------------

Message: 1
Date: Wed, 2 Jan 2013 12:00:51 +0100
From: "Martina Carolina Alagna" <m.alagna@xxxxxxxxxxxx>
To: "'Scott Klement'" <sk@xxxxxxxxxxxxxxxx>,
        <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Help - ftp - get error
Message-ID:
        <!&!AAAAAAAAAAAYAAAAAAAAABKVNWIX1ppAiCYn1imXVJvCgAAAEAAAAEItmmnfz15ImYGNb2Jaw88BAAAAAA==@artmatica.it>

Content-Type: text/plain; charset="us-ascii"

Hi Scott,



>From time to time I get an error on the server FTP , I got it already
>twice
in six months.



This is what happened in both cases:

During a GET FTP operation, I got an error on the side of the linux server, on the side of the client (AS400 program)  I did not get any notice of the error and the job remained idle waiting for an answer.

Also when the FTP session timed out I didn't get any error message.



This is the log I get:

(019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> RETR BORP286177.txt

(019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> 150 Opening data channel for file transfer.

(019643) 03/12/2012 16.04.09 - nmfaout (192.168.202.170)> 425 Can't open data connection.





Could you suggest a way to intercept the error, or a way to avoid the client to remain idle ?

Should I set a time out ???





Cordialmente

______________________________________________

Martina Alagna

ArtMatica Italia srl

zend-solution-partner-S

uff.  06.4060.667

cell. 348-0341087 e-mail  <mailto:b.virzi@xxxxxxxxxxxx> m.alagna@xxxxxxxxxxxx

 <http://www.artmatica.it/> http://www.artmatica.it

P "Rispetta il tuo ambiente, pensa prima di stampare questa e-mail"
" Please consider your environmental responsibility before printing this e-mail







-------------- next part --------------
   Hi Scott,


   From time to time I get an error on the server FTP , I got it already
   twice in six months.


   This is what happened in both cases:

   During a GET FTP operation, I got an error on the side of the linux
   server, on the side of the client (AS400 program)  I did not get any
   notice of the error and the job remained idle waiting for an answer.

   Also when the FTP session timed out I didn't get any error message.


   This is the log I get:

   (019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> RETR
   BORP286177.txt

   (019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> 150 Opening
   data channel for file transfer.

   (019643) 03/12/2012 16.04.09 - nmfaout (192.168.202.170)> 425 Can't
   open data connection.



   Could you suggest a way to intercept the error, or a way to avoid the
   client to remain idle ?

   Should I set a time out ???



   Cordialmente

   ______________________________________________

   Martina Alagna

   ArtMatica Italia srl

   zend-solution-partner-S

   uff.  06.4060.667

   cell. 348-0341087 e-mail [1]m.alagna@xxxxxxxxxxxx

   [2]http://www.artmatica.it

   P "Rispetta il tuo ambiente, pensa prima di stampare questa e-mail"
   " Please consider your environmental responsibility before printing
   this e-mail

References

   1. mailto:b.virzi@xxxxxxxxxxxx
   2. http://www.artmatica.it/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 850 bytes
Desc: not available
URL: <http://scottklement.com/pipermail/ftpapi/attachments/20130102/1414b2ed/attachment.gif>

------------------------------

Message: 2
Date: Wed, 02 Jan 2013 08:43:24 -0600
From: Scott Klement <sk@xxxxxxxxxxxxxxxx>
To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Help - ftp - get error
Message-ID: <50E4478C.6010703@xxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

Hello Martina,

For some reason, it can't open a data connection.   The most common
cause, is a firewall setting.

To know why it's happening to you, you need to do some troubleshooting.
Find out what IP address/port it's attempting to use to build the data connection, and attempt it yourself, manually.  The IP address/port is listed as part of the PORT or PASV subcommand sent during the FTP conversation (you did not provide this information in your message.) Trace it through your network and see if you can determine what's preventing it from making a data connection on that particular address/port.

-SK


On 1/2/2013 5:00 AM, Martina Carolina Alagna wrote:
>     Hi Scott,
>
>
>     From time to time I get an error on the server FTP , I got it already
>     twice in six months.
>
>
>     This is what happened in both cases:
>
>     During a GET FTP operation, I got an error on the side of the linux
>     server, on the side of the client (AS400 program)  I did not get any
>     notice of the error and the job remained idle waiting for an answer.
>
>     Also when the FTP session timed out I didn't get any error message.
>
>
>     This is the log I get:
>
>     (019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> RETR
>     BORP286177.txt
>
>     (019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> 150 Opening
>     data channel for file transfer.
>
>     (019643) 03/12/2012 16.04.09 - nmfaout (192.168.202.170)> 425 Can't
>     open data connection.
>
>
>
>     Could you suggest a way to intercept the error, or a way to avoid the
>     client to remain idle ?
>
>     Should I set a time out ???
>
>
>
>     Cordialmente
>
>     ______________________________________________
>
>     Martina Alagna
>
>     ArtMatica Italia srl
>
>     zend-solution-partner-S
>
>     uff.  06.4060.667
>
>     cell. 348-0341087 e-mail [1]m.alagna@xxxxxxxxxxxx
>
>     [2]http://www.artmatica.it
>
>     P "Rispetta il tuo ambiente, pensa prima di stampare questa e-mail"
>     " Please consider your environmental responsibility before printing
>     this e-mail
>
> References
>
>     1. mailto:b.virzi@xxxxxxxxxxxx
>     2. http://www.artmatica.it/
>
>
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -

-------------- next part --------------
   Hello Martina,
   For some reason, it can't open a data connection.   The most common
   cause, is a firewall setting.
   To know why it's happening to you, you need to do some
   troubleshooting.  Find out what IP address/port it's attempting to use
   to build the data connection, and attempt it yourself, manually.  The
   IP address/port is listed as part of the PORT or PASV subcommand sent
   during the FTP conversation (you did not provide this information in
   your message.)  Trace it through your network and see if you can
   determine what's preventing it from making a data connection on that
   particular address/port.
   -SK

   On 1/2/2013 5:00 AM, Martina Carolina Alagna wrote:

   Hi Scott,


   From time to time I get an error on the server FTP , I got it already
   twice in six months.


   This is what happened in both cases:

   During a GET FTP operation, I got an error on the side of the linux
   server, on the side of the client (AS400 program)  I did not get any
   notice of the error and the job remained idle waiting for an answer.

   Also when the FTP session timed out I didn't get any error message.


   This is the log I get:

   (019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> RETR
   BORP286177.txt

   (019643) 03/12/2012 16.03.58 - nmfaout (192.168.202.170)> 150 Opening
   data channel for file transfer.

   (019643) 03/12/2012 16.04.09 - nmfaout (192.168.202.170)> 425 Can't
   open data connection.



   Could you suggest a way to intercept the error, or a way to avoid the
   client to remain idle ?

   Should I set a time out ???



   Cordialmente

   ______________________________________________

   Martina Alagna

   ArtMatica Italia srl

   zend-solution-partner-S

   uff.  06.4060.667

   cell. 348-0341087 e-mail [[1]1]m.alagna@xxxxxxxxxxxx

   [2][2]http://www.artmatica.it

   P "Rispetta il tuo ambiente, pensa prima di stampare questa e-mail"
   " Please consider your environmental responsibility before printing
   this e-mail

References

   1. [3]mailto:b.virzi@xxxxxxxxxxxx
   2. [4]http://www.artmatica.it/


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

References

   1. mailto:1]m.alagna@xxxxxxxxxxxx
   2. http://www.artmatica.it/
   3. mailto:b.virzi@xxxxxxxxxxxx
   4. http://www.artmatica.it/
   5. http://www.scottklement.com/mailman/listinfo/ftpapi

------------------------------

Message: 3
Date: Wed, 2 Jan 2013 16:07:44 +0100
From: thomas.raddatz@xxxxxx
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: AUTO: Thomas Raddatz/GfD/DE ist au?er Haus. (R?ckkehr am
        07.01.2013)
Message-ID:
        <OF61618284.F6DE132A-ONC1257AE7.00531B05-C1257AE7.00531B05@xxxxxx>
Content-Type: text/plain; charset="iso-8859-1"




Ich bin bis 07.01.2013 abwesend.




Hinweis: Dies ist eine automatische Antwort auf Ihre Nachricht  "Help - ftp
- get error" gesendet am 02.01.2013 12:00:51.

Diese ist die einzige Benachrichtigung, die Sie empfangen werden, w?hrend diese Person abwesend ist.

--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender.
-------------- next part --------------
   Ich bin bis 07.01.2013 abwesend.
   Hinweis: Dies ist eine automatische Antwort auf Ihre Nachricht  "Help -
   ftp - get error" gesendet am 02.01.2013 12:00:51.
   Diese ist die einzige Benachrichtigung, die Sie empfangen werden,
   w?hrend diese Person abwesend ist.

   --
   IMPORTANT NOTICE:
   This email is confidential, may be legally privileged, and is for the
   intended recipient only. Access, disclosure, copying, distribution, or
   reliance on any of it by anyone else is prohibited and may be a
   criminal
   offence. Please delete if obtained in error and email confirmation to
   the sender.

------------------------------

Message: 4
Date: Wed, 2 Jan 2013 11:49:59 -0500
From: PReid@xxxxxxxxxxxx
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system
        state
Message-ID:
        <OF004C3095.DAC78444-ON85257AE7.005C3B37-85257AE7.005C7080@xxxxxxxxxxxx>

Content-Type: text/plain; charset="us-ascii"

Hello everyone. I am having an issue when I attempt to run EXAMPLE3 from library LIBHTTP. I've modified the program as follows:

callp   http_debug(*on)
eval    rc = http_url_get(
             'https://www.fortify.net/sslcheck.html':
             '/tmp/httptest.html')
if      rc <> 1
callp   http_crash
endif

I always get rc = -1 which calls http_crash. The following is what get written to httpapi_debug.txt:

HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V6R1M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_url_get(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: ERBGROUP.COM
DNS server found: 192.168.2.6
DNS server found: 216.171.96.38
DNS server found: 216.16.248.50
https_init(): entered
(GSKit) I/O: Unknown system state.
ssl_error(406): (GSKit) I/O: Unknown system state.
SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system state.

We are running a Power 7 Model: 8202/E4C Processor Group: EPC6 O/S is:
V6R1M0

Nobody (including me) in our shop is familiar with the GSKit. Is it something that is installed on an iSeries? I've checked online, but I can't find any information that tells me how to check if it is installed, or how to check what version it is.

If you had any advice on how I should begin resolving this issue it would be much appreciated.

Thanks very much, Paul.
-------------- next part --------------
   Hello everyone. I am having an issue when I attempt to run EXAMPLE3
   from library LIBHTTP. I've modified the program as follows:
   callp   http_debug(*on)
   eval    rc = http_url_get(
               'https://www.fortify.net/sslcheck.html':
               '/tmp/httptest.html')
   if      rc <> 1
   callp   http_crash
   endif
   I always get rc = -1 which calls http_crash. The following is what get
   written to httpapi_debug.txt:
   HTTPAPI Ver 1.24 released 2012-01-23
   OS/400 Ver V6R1M0
   New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
   http_url_get(): entered
   http_persist_open(): entered
   http_long_ParseURL(): entered
   DNS resolver retrans: 2
   DNS resolver retry  : 2
   DNS resolver options: x'00000136'
   DNS default domain: ERBGROUP.COM
   DNS server found: 192.168.2.6
   DNS server found: 216.171.96.38
   DNS server found: 216.16.248.50
   https_init(): entered
   (GSKit) I/O: Unknown system state.
   ssl_error(406): (GSKit) I/O: Unknown system state.
   SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system state.
   We are running a Power 7 Model: 8202/E4C Processor Group: EPC6 O/S is:
   V6R1M0
   Nobody (including me) in our shop is familiar with the GSKit. Is it
   something that is installed on an iSeries? I've checked online, but I
   can't find any information that tells me how to check if it is
   installed, or how to check what version it is.
   If you had any advice on how I should begin resolving this issue it
   would be much appreciated.
   Thanks very much, Paul.

------------------------------

Message: 5
Date: Wed, 2 Jan 2013 18:01:06 +0100
From: "Magne Kofoed" <ma-kofo@xxxxxxxxxxx>
To: "HTTPAPI and FTPAPI Projects" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: SV: SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system
        state
Message-ID:
        <04C2641A8694804CAB77AD33B8AA81EF01B478CC@xxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

you have to install SSL support on your System i.

Take a look in the README mbr in LIBHTTP/QRPGLESRC and seach for SSL.
Here you will find the "REQUIREMENTS FOR BUILDING WITH SSL SUPPORT"

Best regards,
Magne


________________________________

Fra: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx p? vegne av PReid@xxxxxxxxxxxx
Sendt: on 02.01.2013 17:49
Til: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Emne: SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system state



Hello everyone. I am having an issue when I attempt to run EXAMPLE3 from library LIBHTTP. I've modified the program as follows:

callp   http_debug(*on)
eval    rc = http_url_get(
             'https://www.fortify.net/sslcheck.html':
             '/tmp/httptest.html')
if      rc <> 1
callp   http_crash
endif

I always get rc = -1 which calls http_crash. The following is what get written to httpapi_debug.txt:

HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V6R1M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_url_get(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: ERBGROUP.COM
DNS server found: 192.168.2.6
DNS server found: 216.171.96.38
DNS server found: 216.16.248.50
https_init(): entered
(GSKit) I/O: Unknown system state.
ssl_error(406): (GSKit) I/O: Unknown system state.
SetError() #24: gsk_env_init: (GSKit) I/O: Unknown system state.

We are running a Power 7 Model: 8202/E4C Processor Group: EPC6 O/S is:
V6R1M0

Nobody (including me) in our shop is familiar with the GSKit. Is it something that is installed on an iSeries? I've checked online, but I can't find any information that tells me how to check if it is installed, or how to check what version it is.

If you had any advice on how I should begin resolving this issue it would be much appreciated.

Thanks very much, Paul.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 5612 bytes
Desc: not available
URL: <http://scottklement.com/pipermail/ftpapi/attachments/20130102/36347b98/attachment.bin>

------------------------------

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


End of Ftpapi Digest, Vol 75, Issue 1
*************************************

-----------------------------------------------------------------------
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
-----------------------------------------------------------------------