This project is read-only.

FTPException Invalid Port Command

Aug 9, 2010 at 10:26 AM


I have a sporadic issue using ftplib.  The following exception is caught by my program. The service looks every minute if new files have arrived. This error comes a few times. Then it works normally again and after a couple of hours the error raises again a couple of times. What could that be?


eventlog: FtpLib.FtpException: 200 Type set to A.

500 Invalid PORT Command.

500 'LPRT 6,16,0,0,0,0,0,0,0,0,144,130,148,124,128,159,148,124,2,10,124': command not understood

at FtpLib.FtpConnection.Error()  

at FtpLib.FtpConnection.GetFiles(String mask)

at ITC.Schnittstelle.Service.ITCImportService.FTP()

Thanks in advance

Aug 23, 2010 at 3:46 PM

It seems that there may be an issue with wininet running steadily for a while. It increments the port number it sends every time and can eventually run over the 64K mark. I would suggest you either periodically disconnect and reconnect to the FTP server, or try sending the PASV command so the client doesn't have to worry about port allocation.

Aug 23, 2010 at 3:51 PM

After reviewing this discussion, this is probably the problem. Try sending PASV, I will update the constant and commit.

Aug 23, 2010 at 5:04 PM

Hello Scott,

thanks for the info. I will update my source.