Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.2k views
in .NET FTP by (200 points)
Hi,
I wonder if anyone can help?
I keep getting a Null Reference Exception when i try and ftp files using the edtftpnet library.

The error i get is:

Object Reference not set to an instance of an object at EnterpriseDT.net.FTP.FTPControlSocket.Log(String msg,Boolean)
at FTPControlSocket.ReadReply
at FTPControlSocket.SendCommand(String command)
at FTPClient.Quit

I thought that it might be that i had not got logging set up, so i have added the logging to my program and get the same error, the error log is as follows:

DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 25 Jul 2005 09:32:45.403 : Connecting to 64.119.175.163:21
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:45.653 : 220 je20006 Microsoft FTP Service (Version 5.0).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:45.653 : ---> USER boltgun.co.uk
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:45.778 : 331 Password required for boltgun.co.uk.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:45.778 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:45.887 : 230 User boltgun.co.uk logged in.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:45.887 : ---> TYPE A
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:46.012 : 200 Type set to A.
INFO [RDSFTP.clsFTP] 25 Jul 2005 09:32:46.012 : Logged In
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:46.028 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:46.153 : 227 Entering Passive Mode (64,119,175,163,9,25).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:46.262 : ---> STOR Reports\\2005-07-24 1200JourneyExcel.xls
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:46.387 : 125 Data connection already open; Transfer starting.
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 25 Jul 2005 09:32:47.231 : Transferred 41984 bytes to remote host
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:47.356 : 226 Transfer complete.
INFO [RDSFTP.clsFTP] 25 Jul 2005 09:32:47.356 : Uploaded \2005-07-24 1200JourneyExcel.xls
INFO [RDSFTP.clsFTP] 25 Jul 2005 09:32:47.356 : Trying to quit
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 25 Jul 2005 09:32:47.356 : ---> QUIT

I have another Log.Info after the Quit which is not shown.

Any ideas?

The thing which seems strange to me is that the files are successfully uploaded, and the code appears to work on my dev machine.

Cheers

Toby

3 Answers

0 votes
by (200 points)
Hi,

Well i appear to have fixed my problem by switching from using ftp.quit to ftp.quitimmediately.

It all appears to finish properly. Can anyone shed any light as to why this should fix the problem (or even the difference between quit and quitimmedately?)

Otherwise, guess i will just accept that it works and leave it at that.

Cheers

Toby
0 votes
by (161k points)
Instead of sending a response to the FTP QUIT command, some servers simply close the control socket. Using QuitImmediately will cope with this, while Quit expects the standard response.

Hi,

Well i appear to have fixed my problem by switching from using ftp.quit to ftp.quitimmediately.

It all appears to finish properly. Can anyone shed any light as to why this should fix the problem (or even the difference between quit and quitimmedately?)

Otherwise, guess i will just accept that it works and leave it at that.

Cheers

Toby
0 votes
by (200 points)
Cheers, thanks for clearing that up for me.

Categories

...