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

Re: Strange error with ftpapi



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

-----Messaggio originale----- 
From: Dennis Lovelady
Sent: Friday, February 11, 2011 8:47 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: RE: Strange error with ftpapi

Hi, Mario:

The 6-byte values in parentheses do start with an IP address.  But the next 
two bytes are the PORT number assigned to the transaction.  As an easy 
example, if port 16384 (x'4000') had been assigned to a transaction with IP 
address 1.3.5.7, you would see something like this in the text:

> 0: 227 Entering Passive Mode (1, 3, 5, 7, 64, 0)

As far as the long wait: when you are waiting for the remote system to 
reply, (in this case, send a file), the program (API) will stay in RECEIVE 
mode until end of file is indicated by the remote system.  Either that is 
not occurring or the occurrence is being blocked in some manner such as a 
firewall.

You could force a timeout value by specifying that in your FTP_CONN or 
FTP_OPEN function call.  That should stop the waiting and return a -1 to 
your receiving procedure when this occurs.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Always do right. This will gratify some people and astonish the rest."
        -- Mark Twain


> I am using ftpapi to send and receive a file to another host. It works
> very well but sometimes it happen that the application wait
> indefinitely. The program does the following steps:
> Connect to the server ftp(ftp_conn),
> set the passive mode(FTP_passiveMode)
> change directory (ftp_chdir)
> send the file(ftp_put)
> wait few second
> change directory (ftp_chdir)
> get the file, i.e. the answer,(ftp_get)
> end the connection (ftp_quit)
> Looking into the log I see this jolog:
> 0: FTPAPI version 2.3 released on 2010-05-27
> 0: 220 en1 FTP server (Version 4.1 Mon Jul 26 19:58:48 CDT 1999) ready.
> 0: > USER nike
> 0: 331 Password required for nike.
> 0: > PASS **********
> 0: 230 User nike logged in.
> 0: > CWD in
> 0: 250 CWD command successful.
> 0: > TYPE I
> 0: 200 Type set to I.
> 0: > PASV
> 0: 227 Entering Passive Mode (80,19,175,115,124,210)        <-----
> this is the correct IP addr of the ftp server
> 0: > STOR 3056010.ORD
> 0: 150 Opening data connection for 3056010.ORD.
> 0: 226 Transfer complete.
> 0: > CDUP
> 0: 250 CWD command successful.
> 0: > CWD out
> 0: 250 CWD command successful.
> 0: > TYPE I
> 0: 200 Type set to I.
> 0: > PASV
> 0: 227 Entering Passive Mode (192,168,100,3,187,154)      <----  ip
> addr???
> 0: > TYPE I
> 0: 200 Type set to I.
> 0: > PASV
> 0: 227 Entering Passive Mode (192,168,100,3,187,220)   <---- IP addr??
> I don’t understand these strange ip addr.
> Can someone help me to understand why the pgm wait and why there are
> these Ip addr?
> Thanks in advance
> Mario

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