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

Re: Strange error with ftpapi



Hi Scott
thanks for you answer . I agree with you and this appears to be a bug in the ftp server and I ask ftp server responsable for this. About the bug for ftpapi I attach the source of my program as Mike asked.
Thanks again for all
Mario

-----Messaggio originale----- From: Scott Klement
Sent: Monday, February 14, 2011 6:42 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Strange error with ftpapi

Hi Mario,

The address in a PASV response is sent from the FTP server to FTPAPI.
This appears to be a bug in the FTP server (or perhaps it's NAT gateway)
that is causing it to send you the wrong IP address information.  Not
much I can do about that.

I don't know why FTPAPI isn't timing out, though...  that might be a bug
in FTPAPI...?  not sure how to debug/troubleshoot it, though.


On 2/14/2011 10:12 AM, Mario Martoriello wrote:
Hi Dennis
thank you for your answer.
1) I open the connection specifying the timeout (120) but after 2 min the
connection doesn't stop and doesn't  give me  any -1
2) I know that the first 4 byte in parentheses are the IP address and the
last 2 are the port number, what it sounds strange are the first 4 byte that when the proc hangs show an IP address different from the IP address which I
connected.(see my log I connect  to 80,19,175,115 and the other address is
192.168.100.3). Besides the file that I'm waiting isn't a very big file (80 bytes to 250 bytes at all). I investigate with the ftp server provider and I understand that the 192.168.100.3 is their internal IP address. So how is
possible  this ?
thanks again
Mario

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
0229.00  * connect to FTP server.  Log in with user name & password:
0230.00 C                   eval      sess =  ftp_conn(%TrimL($FtpServer):
0231.00 C                                %TrimL($FtpUser):%Triml($FtpPsw):
0232.00 C                                FTP_PORT:120)
0233.00 c                   if        sess < 0
0234.00 c                   eval      Msg = ftp_errorMsg(0)
0235.00 c                   dsply                   Msg
0236.00 c                   eval      *inlr = *on
0237.00 c                   return
0238.00 c                   endif
0239.00  *Set passive mode to FTP server.
0240.00 c                   if        FTP_passiveMode(sess:*ON) < 0
0241.00 c                   eval      Msg = ftp_errorMsg(0)
0242.00 c                   dsply                   Msg
0243.00 c                   callp     ftp_quit(Sess)
0244.00 c                   eval      *inlr = *on
0245.00 c                   return
0246.00 c                   endif
0247.00  * Set directory sul server ....
0248.00 c                   If        $FtpDirIn <> *BLANKS
se significativa
0249.00 c                   If        ftp_chdir(sess:%TRiml($FtpDirIn)) < 0
Remote folder to put
0250.00 c                   eval      Msg = ftp_errorMsg(Sess)
0251.00 c                   dsply                   Msg
0252.00 c                   callp     ftp_quit(Sess)
0253.00 c                   eval      *inlr = *on
0254.00 c                   return
0255.00 c                   endif
0256.00 c                   EndIf
0257.00  * ....send the request...
0258.00 C                   EVAL      text = 'Richiesta disponibilità per il
' +
0259.00 C                               'prodotto ' + Y1Min32 + ' al
grossista '+
0260.00 C                              £Grossista + Blank + £CdDepos +' in
corso..'
0261.00 C                   CALLP     sndMsg(text)
0262.00 c                   callp     ftp_put(sess:%TRimL(FileOrdi) :
0263.00 c                                          %TRimL(NomeFile))
0264.00  * Set directory on server where get the answer  ...
0265.00 c                   If        $FtpDirOut<> *BLANKS
se significativa
0266.00 c                   IF        ftp_chdir(sess:'..') < 0
torna alla root
0267.00 c                   eval      Msg = ftp_errorMsg(Sess)
0268.00 c                   dsply                   Msg
0269.00 c                   callp     ftp_quit(Sess)
0270.00 c                   eval      *inlr = *on
0271.00 c                   return
0272.00 c                   endif
0273.00 c                   If        ftp_chdir(sess:%TRiml($FtpDirOut)) < 0
Remote folder to get
0274.00 c                   eval      Msg = ftp_errorMsg(Sess)
0275.00 c                   dsply                   Msg
0276.00 c                   callp     ftp_quit(Sess)
0277.00 c                   eval      *inlr = *on
0278.00 c                   return
0279.00 c                   endif
0280.00 c                   EndIf
0281.00  * Wait 1 second to read the answer......
0282.00 c                   callp     p_wait(1)
attende 1 sec circa
0283.00  * Ricevo quindi file con disponibilità richiesta...
0284.00  * Cancella eventuali vecchi file presenti....  ..
0285.00 c                   if        unlink(nomefilM) < 0
0286.00 c                   eval      err = errno
0287.00 c                   if        err <> ENOENT
0288.00 c                   callp     die('unlink(): ' +
%str(strerror(err)))
0289.00 c                   endif
0290.00 c                   endif
0291.00  * Ricevo file con risposta disponibilità e se errore attende prima
di riprovare.....
0292.00 c                   EVAL      Z= 0
0293.00 c     1             DO        $MaxTent      Z
0294.00 c                   if        ftp_get(Sess:%TRIML(Filedocu):
0295.00 c                                          %TRIML(NomefilM)) < 0
0296.00 C                   EVAL      text = 'Attesa risposta disponibilità
per ' +
0297.00 C                                'il prodotto ' + Y1Min32 +
0298.00 C                                ' dal grossista '+ £Grossista +
Blank +
0299.00 C                                %TRIMR(£CdDepos) + ' in corso.(' +
0300.00 C                                %EDITC(Z:'Z') + RParen
0301.00 C                   CALLP     sndMsg(text)
0302.00 c                   callp     p_wait(3)
attende 3 sec circa
0303.00 c                   EVAL      Z= Z +1
0304.00 c                   Else
0305.00 c                   Leave
0306.00 c                   EndIf
0307.00 c                   ENDDO
0308.00 c                   If        Z > $MaxTent
0309.00 c                   eval      Msg = ftp_errorMsg(sess)
0310.00 c                   dsply                   Msg
0311.00 c                   callp     ftp_quit(Sess)
0312.00 c                   eval      *inlr = *on
0313.00 c                   return
0314.00 c                   Else
0315.00  * ...tutto ok cancello file del documento dal server del grossista
0316.00 c                   IF        Pg_GPRODOC = 'GE'
Generico
0317.00 c                   CAllp     ftp_delete(Sess:%TRIML(Filedocu))
0318.00 c                   EndIf
0319.00 c                   EndIf
0320.00  *
0321.00 C                   EVAL      text = 'Ricezione disponibilità per '
+
0322.00 C                                'il prodotto ' + Y1Min32 +
0323.00 C                                ' dal grossista '+ £Grossista +
Blank +
0324.00 C                                 £CdDepos + ' conclusa'
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------