Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
7.1k views
in .NET FTP by (280 points)
Greetings.
I am new to FTP (so likely missing something obvious) and using the trial Compact Framework version of the FTP Client.
Downloading to my CE 5 device from XP (SP3) works fine.
I am getting a timeout however when trying to upload to the PC.
An empty file is created on the PC in the correct directory but no data is transferred.

I have turned off the standard Windows XP firewall on the PC in case this was causing the problem but it made no difference.

A the bottom is the log from the CE 5 client, but first here is the server log.

Tue Nov 04 19:00:27 2008 0 Incoming connection request on interface 192.168.0.4
Tue Nov 04 19:00:27 2008 0 Connection request accepted from 192.168.0.9
Tue Nov 04 19:00:27 2008 0 USER Anonymous
Tue Nov 04 19:00:27 2008 0 TYPE I
Tue Nov 04 19:00:27 2008 0 PWD
Tue Nov 04 19:00:27 2008 0 TYPE I
Tue Nov 04 19:00:28 2008 0 CWD C\Temp\Upload
Tue Nov 04 19:00:28 2008 0 PWD
Tue Nov 04 19:00:28 2008 0 PASV
Tue Nov 04 19:00:28 2008 0 Connection with data socket accepted
Tue Nov 04 19:00:28 2008 0 STOR UploadFile.TXT
Tue Nov 04 19:02:08 2008 0 Connection timed out. Shutting down connection...
Tue Nov 04 19:02:08 2008 0 Cerberus Exception: Connection closed during file transfer
Tue Nov 04 19:02:08 2008 0 Connection terminated.
Tue Nov 04 19:11:36 2008 0 Incoming connection request on interface 192.168.0.4
Tue Nov 04 19:11:36 2008 0 Connection request accepted from 192.168.0.9
Tue Nov 04 19:11:36 2008 0 USER Anonymous
Tue Nov 04 19:11:36 2008 0 TYPE I
Tue Nov 04 19:11:36 2008 0 PWD
Tue Nov 04 19:11:36 2008 0 TYPE I
Tue Nov 04 19:11:36 2008 0 CWD C\Temp\Upload
Tue Nov 04 19:11:36 2008 0 PWD
Tue Nov 04 19:11:37 2008 0 PASV
Tue Nov 04 19:11:37 2008 0 Connection with data socket accepted
Tue Nov 04 19:11:37 2008 0 STOR UploadFile.TXT
Tue Nov 04 19:13:17 2008 0 Connection timed out. Shutting down connection...
Tue Nov 04 19:13:17 2008 0 Cerberus Exception: Connection closed during file transfer
Tue Nov 04 19:13:17 2008 0 Connection terminated.

Hee is the log from the client:

DEBUG [FormFTP] 4 Nov 2008 19:10:34.000 : FormFTP() initializing
INFO [LicenseProperties] 4 Nov 2008 19:10:35.000 : Licence expiry date: 3/12/2008
INFO [LicenseProperties] 4 Nov 2008 19:10:35.000 : Trial license
INFO [LicenseProperties] 4 Nov 2008 19:10:35.000 : Licence expiry date: 3/12/2008
INFO [LicenseProperties] 4 Nov 2008 19:10:35.000 : Trial license
DEBUG [ExFTPClient] 4 Nov 2008 19:10:35.000 : Connecting to 192.168.0.4:21
DEBUG [HostNameResolver] 4 Nov 2008 19:10:35.000 : 192.168.0.4 resolved to 192.168.0.4
DEBUG [ExFTPControlSocket] 4 Nov 2008 19:10:35.000 : Connecting directly to ftp-server 192.168.0.4:21
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:36.000 : Setting socket timeout=120000
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:36.000 : Command encoding=System.Text.ASCIIEncoding
DEBUG [ExFTPControlSocket] 4 Nov 2008 19:10:36.000 : Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=192.168.0.4, controlPort=21, timeout=120000
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:36.000 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:36.000 : 220-Welcome to Cerberus FTP Server
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:36.000 : 220 Created by Grant Averett
DEBUG [FTPConnection] 4 Nov 2008 19:10:37.000 : Connected to 192.168.0.4
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> USER Anonymous
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 230 User Anonymous logged in
DEBUG [FTPConnection] 4 Nov 2008 19:10:37.000 : Successfully logged in
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.ExFTPConnection] 4 Nov 2008 19:10:37.000 : Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 200 Type Binary
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> PWD
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 257 "/" is the current directory
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> TYPE I
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 200 Type Binary
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> CWD C\Temp\Upload
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 250 Change directory ok
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> PWD
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 257 "/C/Temp/Upload" is the current directory
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> PASV
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 227 Listening on (192,168,0,4,4,36)
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : Server supplied address=192.168.0.4
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : Server supplied port=1060
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : Substituting server supplied IP (192.168.0.4) with remote host IP (192.168.0.4)
DEBUG [ExFTPControlSocket] 4 Nov 2008 19:10:37.000 : NewPassiveDataSocket(192.168.0.4,1060)
DEBUG [ExFTPControlSocket] 4 Nov 2008 19:10:37.000 : Connecting directly to ftp-server 192.168.0.4:1060
DEBUG [ExFTPPassiveDataSocket] 4 Nov 2008 19:10:37.000 : Created passive data-socket: ProxyConnector=
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : ---> STOR UploadFile.TXT
DEBUG [FTPControlSocket] 4 Nov 2008 19:10:37.000 : 150 Opening data connection
DEBUG [FTPClient] 4 Nov 2008 19:13:47.000 : Closing source stream
ERROR [FTPClient] 4 Nov 2008 19:13:47.000 : Caught exception : System.IO.IOException: Unable to write data to the transport connection.
System.IO.IOException: Unable to write data to the transport connection.
CAUSED BY:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
ERROR [FTPClient] 4 Nov 2008 19:13:47.000 : IOException in Put(string,string,bool) : System.IO.IOException: Unable to write data to the transport connection.
System.IO.IOException: Unable to write data to the transport connection.
CAUSED BY:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
DEBUG [FTPControlSocket] 4 Nov 2008 19:13:47.000 : Setting socket timeout=500
DEBUG [FTPControlSocket] 4 Nov 2008 19:13:47.000 : 500 File transfer failed
INFO [FTPControlSocket] 4 Nov 2008 19:13:47.000 : Expected reply codes = [225,226,250,426,450] (strict=False)
DEBUG [FTPControlSocket] 4 Nov 2008 19:13:47.000 : Setting socket timeout=120000
DEBUG [FTPControlSocket] 4 Nov 2008 19:13:51.000 : ---> DELE UploadFile.TXT
ERROR [FTPControlSocket] 4 Nov 2008 19:13:51.000 : Control channel unexpectedly closed
ERROR [FTPControlSocket] 4 Nov 2008 19:13:51.000 : Exception in SendCommand : System.SystemException: Control channel unexpectedly closed
System.SystemException: Control channel unexpectedly closed
ERROR [EnterpriseDT.Net.Ftp.ExFTPConnection] 4 Nov 2008 19:13:51.000 : Command error : System.SystemException: Control channel unexpectedly closed
System.SystemException: Control channel unexpectedly closed
DEBUG [FTPControlSocket] 4 Nov 2008 19:13:51.000 : ---> QUIT
ERROR [FTPControlSocket] 4 Nov 2008 19:13:51.000 : Exception in SendCommand : System.IO.IOExce

8 Answers

0 votes
by (162k points)
In passive mode, the client has to make a connection to the server for each listing or file transfer.

It looks like the client is failing to connect to the server on the port number that the server is supplying. This is normally because of a firewall somewhere.

Are you saying your code works fine if you download from the PC to CE, but fails if you upload? Are you able to post a log that first successfully downloads and then fails to upload?
0 votes
by (280 points)
Thanks for the quick response.
Yes, it works fine if I download from PC to CE.
Here is a log with the download ok, followed by the upload timeout.
Is it possible that a firewall would allow a download but not an upload?
I will do more investigating re firewalls. Maybe I need to reboot my XP machine after disabling it, or perhaps my WiFi access point or router is causing an issue.
I will have no time today to look further but will get back to it tomorrow.

Regards,
John.

DEBUG [FormFTP] 5 Nov 2008 08:21:40.000 : FormFTP() initializing
INFO [LicenseProperties] 5 Nov 2008 08:21:40.000 : Licence expiry date: 3/12/2008
INFO [LicenseProperties] 5 Nov 2008 08:21:40.000 : Trial license
INFO [LicenseProperties] 5 Nov 2008 08:21:40.000 : Licence expiry date: 3/12/2008
INFO [LicenseProperties] 5 Nov 2008 08:21:40.000 : Trial license
DEBUG [ExFTPClient] 5 Nov 2008 08:21:40.000 : Connecting to 192.168.0.4:21
DEBUG [HostNameResolver] 5 Nov 2008 08:21:40.000 : 192.168.0.4 resolved to 192.168.0.4
DEBUG [ExFTPControlSocket] 5 Nov 2008 08:21:41.000 : Connecting directly to ftp-server 192.168.0.4:21
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:41.000 : Setting socket timeout=120000
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:41.000 : Command encoding=System.Text.ASCIIEncoding
DEBUG [ExFTPControlSocket] 5 Nov 2008 08:21:41.000 : Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=192.168.0.4, controlPort=21, timeout=120000
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:41.000 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:41.000 : 220-Welcome to Cerberus FTP Server
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:41.000 : 220 Created by Grant Averett
DEBUG [FTPConnection] 5 Nov 2008 08:21:41.000 : Connected to 192.168.0.4
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:41.000 : ---> USER Anonymous
DEBUG [EnterpriseDT.Net.Ftp.ExFTPConnection] 5 Nov 2008 08:21:41.000 : Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:42.000 : 230 User Anonymous logged in
DEBUG [FTPConnection] 5 Nov 2008 08:21:42.000 : Successfully logged in
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:42.000 : ---> TYPE I
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:42.000 : 200 Type Binary
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:42.000 : ---> PWD
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:42.000 : 257 "/" is the current directory
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : ---> TYPE I
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : 200 Type Binary
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : ---> CWD C\Temp
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : 250 Change directory ok
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : ---> PWD
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : 257 "/C/Temp" is the current directory
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : ---> SIZE RMSScan_DOWNLOAD.TXT
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : 213 1739056
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:43.000 : ---> PASV
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:44.000 : 227 Listening on (192,168,0,4,4,20)
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:44.000 : Server supplied address=192.168.0.4
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:44.000 : Server supplied port=1044
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:44.000 : Substituting server supplied IP (192.168.0.4) with remote host IP (192.168.0.4)
DEBUG [ExFTPControlSocket] 5 Nov 2008 08:21:44.000 : NewPassiveDataSocket(192.168.0.4,1044)
DEBUG [ExFTPControlSocket] 5 Nov 2008 08:21:44.000 : Connecting directly to ftp-server 192.168.0.4:1044
DEBUG [ExFTPPassiveDataSocket] 5 Nov 2008 08:21:44.000 : Created passive data-socket: ProxyConnector=
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:44.000 : ---> RETR RMSScan_DOWNLOAD.TXT
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:44.000 : 150 Opening data connection
DEBUG [FTPClient] 5 Nov 2008 08:21:52.000 : Transferred 1739056 bytes from remote host
DEBUG [FTPControlSocket] 5 Nov 2008 08:21:52.000 : 226 Transfer complete
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : ---> TYPE I
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : 200 Type Binary
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : ---> PASV
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : 227 Listening on (192,168,0,4,4,21)
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : Server supplied address=192.168.0.4
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : Server supplied port=1045
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : Substituting server supplied IP (192.168.0.4) with remote host IP (192.168.0.4)
DEBUG [ExFTPControlSocket] 5 Nov 2008 08:22:11.000 : NewPassiveDataSocket(192.168.0.4,1045)
DEBUG [ExFTPControlSocket] 5 Nov 2008 08:22:11.000 : Connecting directly to ftp-server 192.168.0.4:1045
DEBUG [ExFTPPassiveDataSocket] 5 Nov 2008 08:22:11.000 : Created passive data-socket: ProxyConnector=
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : ---> STOR UploadFile.TXT
DEBUG [FTPControlSocket] 5 Nov 2008 08:22:11.000 : 150 Opening data connection
DEBUG [FTPClient] 5 Nov 2008 08:25:21.000 : Closing source stream
ERROR [FTPClient] 5 Nov 2008 08:25:21.000 : Caught exception : System.IO.IOException: Unable to write data to the transport connection.
System.IO.IOException: Unable to write data to the transport connection.
CAUSED BY:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
ERROR [FTPClient] 5 Nov 2008 08:25:21.000 : IOException in Put(string,string,bool) : System.IO.IOException: Unable to write data to the transport connection.
System.IO.IOException: Unable to write data to the transport connection.
CAUSED BY:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
DEBUG [FTPControlSocket] 5 Nov 2008 08:25:21.000 : Setting socket timeout=500
DEBUG [FTPControlSocket] 5 Nov 2008 08:25:21.000 : 500 File transfer failed
INFO [FTPControlSocket] 5 Nov 2008 08:25:21.000 : Expected reply codes = [225,226,250,426,450] (strict=False)
DEBUG [FTPControlSocket] 5 Nov 2008 08:25:21.000 : Setting socket timeout=120000
DEBUG [FTPControlSocket] 5 Nov 2008 08:25:32.000 : ---> QUIT
ERROR [FTPControlSocket] 5 Nov 2008 08:25:32.000 : Control channel unexpectedly closed
ERROR [FTPControlSocket] 5 Nov 2008 08:25:32.000 : Exception in SendCommand : System.SystemException: Control channel unexpectedly closed
System.SystemException: Control channel unexpectedly closed
ERROR [EnterpriseDT.Net.Ftp.ExFTPConnection] 5 Nov 2008 08:25:32.000 : Command error : System.SystemException: Control channel unexpectedly closed
System.SystemException: Control channel unexpectedly closed
DEBUG [EnterpriseDT.Net.Ftp.ExFTPConnection] 5 Nov 2008 08:25:32.000 : KeepAlive thread finished.
0 votes
by (280 points)
More information...
I have modified the edtFTPnetCF-Demo program simply to do an ftp.UploadFile("\\FromFile.txt", "ToFile.txt", false) to eliminate the rest of my code.
This gives the same result as my app, i.e. it downloads ok but does not upload from my CE 5 device. However ...

As this is a .NET application, I can run the same modified version of edtFTPnetCF-Demo on my XP laptop connected to the same WiFi network and it uploads ok (using edtFTPnetCF.dll).

So.. it would seem that something on the CE device is causing the upload to fail. I don't think it has a firewall.
Does anyone have any idea what it could be?

Also I have tried another FTP client that I found on the Web and it displays a similar problem so I don't think it is an edt issue.

John.
0 votes
by (162k points)
The data connection to the server is failing. It tries to connect to the server but seems to fail. The weird thing is that there's not much different between upload or download. They both work the same way.

It sounds like a firewall or routing problem, somehow. But why one works and the other fails, I don't know. I'm sorry we aren't able to help more - if you do find out what the problem is please follow up with a post.
0 votes
by (280 points)
Thanks Bruce.
I have now tried a different model of device from the same manufacturer, also running CE5. The upload works fine.
So I have now narrowed the problem down to either the firmware in CE device (perhaps the build of CE or hardware drivers) or a hardware problem with the device itself.
I will now get another of the same model with the same firmware and see if it exhibits the same problem.
Will let you know.

John.
0 votes
by (162k points)
Interesting, that's a really unusual problem!
0 votes
by (280 points)
Just in case you are still interested .. here is an update.
I cannot get hold of another device the same, and the next batch to be imported will have different wireless modules (no explanation of why they changed yet) so a direct comparison of my unit against another will not be possible, and hopefully the problem will be gone.

Anyway, I was wrong in saying the upload always fails. I have now discovered that it will consistently upload successfully a file of size 924 bytes or less.
A file of 925 bytes or more will consistently fail.

Now 924 or 925 are not numbers that give me a clue as to where the problem lies. Maybe block size in the wireless card or driver.

I am continuing development on my other CE device that does work and will be purchasing the EDT FTP net CF client.

Regards,
John.
0 votes
by (162k points)
Ok, I hope the problem goes with the new device!

Categories

...