ftp upload problem

J

Joe Abou Jaoude

Hi, I m facing problems with FTP in windows ce.net. I m testing my
application on the emulator. I m able to open the connection to the ftp
site, however I m not able to copy the file, though an empty file is
created on the ftp server.
If i want to upload myfile.txt , a new file myfile.txt appears on the
ftp server but with 0 size.
Does this problem sounds familiar ?

FtpPutFile is returning the 12003 error code, which, according to the
msdn documentation, is an extended error, and I should call
InternetGetLastResponseInfo to retrieve the error text.
However when I m calling the InternetGetLastResponseInfo, I m not
getting any text. This is how I m doing :

1- define the InternetGetLastResponseInfo:

Public Shared Function InternetGetLastResponseInfo( _
ByRef lpdwError As Int32, _
ByVal lpszBuffer As System.Text.StringBuilder, _
ByRef lpdwBufferLength As Int32) As Int32
End Function

2-try to get the error text:

Dim lpdwError As Int32 = 0
Dim lpdwBufferLength As Int32 = 2048
Dim lpszBuffer As _
New System.Text.StringBuilder(lpdwBufferLength)
InternetGetLastResponseInfo( _
lpdwError, lpszBuffer, lpdwBufferLength)
MsgBox(lpszBuffer.ToString)

the lpszBuffer length is 0 and no text is displayed.
Couldn't be that there are no error text or am I doing something wrong ?

Thx
 
L

Lance R.

Hi, I m facing problems with FTP in windows ce.net. I m testing myapplication on the emulator. I m able to open the connection to the
site, however I m not able to copy the file, though an empty file
is created on the ftp server.
If i want to upload myfile.txt , a new file myfile.txt appears on the
ftp server but with 0 size.
Does this problem sounds
familiar ?

Yes. The file gets created as soon as the client implementation
sends the STOR command to the server. Then, assuming you're using active mode,
the server will attempt to connect to the client to start the data transfer.
The file remains at zero bytes because this connection is never able to be made.
Try working in passive mode instead, so that your client can connect to the
server for the data connection.

Regards,
Lance R.
/n
software
http://www.nsoftware.com/

-
 
J

Joe Abou Jaoude

sorry sergey but the link to the TestFTP sample redirect to the same
sample that i have. there's no InternetGetLastResponseInfo in it. I'll
appreciate if u can give me the proper link so that I try to track the
error.

And yes i ve tried to upload files from my desktop computer to the ftp
server many times.

About opennetcf, If i undertsood well, when i install it, I'll get all
the classes of the OpenNetCF namespace, and I'll still be able to use
the regular classes of the compact framework . right ?
is it compatible with windowce.net ?
is there a cab file that i can use to install the opennetcf on each
windowsce.net device ?

regards
 
S

Sergey Bogdanov

It seems that you have caching problem try something like this to
download new file:
http://www.sergeybogdanov.com/Samples/TestFTP.zip?randvalue

OpenNETCF is just a framework (set of classes) that you can use together
with your projects and yes, it's compatible with WindowsCE.

After installation you can find all OpenNETCF CABs here:
....Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.­5000\Windows CE\wce400\[processor type]
 
J

Joe Abou Jaoude

hi,
the problem is solved. it is the passive mode that was causing the
error. So i guess Lancer R actually meant to use active mode.

the error i was getting is the folowing:
"Error:200 Type set to I.
227 Entering Passive Mode (195,112,196,114,12,153).
426 Connection closed; transfer aborted.
"

When I switched to active mode, the sample worked fine.

I don't know what's the difference between active and passive mode, but
as i understood from some readings, that might be caused by firewalls,
right ?

and thanx for you two guys
regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top