ArianeSoft - Programming and development for Windows and Windows Mobile :: Forums :: PPL - Pocket Programming Language :: Code sharing
 
<< Previous thread | Next thread >>
Transferring a file via FTP
Moderators: kornalius, bmanske, PointOfLight
Author Post
PointOfLight
Wed May 21 2008, 01:05pm

Registered Member #49
Joined: Sun Sep 17 2006, 03:02pm
Posts: 1129
I have attached a simple example of how to FTP a file using the WinSock commands.  For the variables user$ and password$, you can either hard code those with the appropriate values or create variables like I did.  Also, be sure to replace the IP address with the appropriate one for your FTP server.  Finally, I've only tested this on the PC at this point.  I will try it on the PPC when I get home tonight.  If someone gets the chance beforehand, please let us know what you find.  Enjoy!

1211389528_49_FT0_ftp_file.zip

Eric Pankoke
Founder
Point Of Light Software
http://www.polsoftware.com/
Back to top
quangdx
Thu May 22 2008, 03:01pm

Registered Member #87
Joined: Mon Oct 02 2006, 07:34pm
Posts: 157
amazing,
so simple, which is the best solution,

although i've just tried it on my ppc,
it connects to the ftp but then i get
unable to transfer file...
it works fine on my PC though.

also my other question is, how secure is this going to be?
will people be able to steal my ftp login and password?


[ Edited Thu May 22 2008, 03:03pm ]

the science of play
www.asobitech.com
Back to top
PointOfLight
Fri May 23 2008, 01:51pm

Registered Member #49
Joined: Sun Sep 17 2006, 03:02pm
Posts: 1129
I guess that really depends on how the API works.  If it encrypts the user name and password then you should be fine as far as security is concerned.  I guess I'd look more indepth into the InternetConnect function for an answer to that.

As for the program not working on your PPC, I hate to ask this stupid question, but are you sure the file exists on the PPC and the path is right?  I just tried it on mine and it works just fine (including transferring the file).

Eric Pankoke
Founder
Point Of Light Software
http://www.polsoftware.com/
Back to top
quangdx
Fri May 23 2008, 03:15pm

Registered Member #87
Joined: Mon Oct 02 2006, 07:34pm
Posts: 157
i'm using

result$ = FtpPutFile(connection$, "hello.txt", "hello.txt", FTP_TRANSFER_TYPE_ASCII, 0);

and placing the hello.txt file in the same direcory as the exe files.
do i need to state the complete path on the PPC.
tested this on both a Vario II(hermes) and Compact III(artemis)
maybe cos they're both running windows mobile 6.1 that may have something to do with it.

the science of play
www.asobitech.com
Back to top
quangdx
Fri May 23 2008, 03:24pm

Registered Member #87
Joined: Mon Oct 02 2006, 07:34pm
Posts: 157
okay, the probelm was to do with the paths
when running it on my PPC I have to state the complete path for the file.

result$ = FtpPutFile(connection$, "\\Storage Card\\ppl\\hello.txt", "hello.txt", FTP_TRANSFER_TYPE_ASCII, 0);

works all good.
a little bit frustrating, but nothing i can't work around.
cheers eric.

the science of play
www.asobitech.com
Back to top
PointOfLight
Fri May 23 2008, 04:05pm

Registered Member #49
Joined: Sun Sep 17 2006, 03:02pm
Posts: 1129
Actually, if the file is going to be in the same path as the executable, just do

AppPath$ + "hello.txt"

This is what I did and it worked just fine on my PPC.

Eric Pankoke
Founder
Point Of Light Software
http://www.polsoftware.com/
Back to top
quangdx
Sat May 24 2008, 09:52am

Registered Member #87
Joined: Mon Oct 02 2006, 07:34pm
Posts: 157
is there any way to read/display the messages the ftp host returns?
errors and confirmations, etc.

the problem I'm having is,
when I try to connect over the phone/gprs network connection, it won't connect to the FTP site.
it's fine when connected via wifi or synced with the USB cable to my PC.
this isn't gonna be very good if i want to write games people will be able to play online while they're out and about on the PocketPC phones.

[ Edited Sat May 24 2008, 10:44am ]

the science of play
www.asobitech.com
Back to top
quangdx
Sat May 24 2008, 12:17pm

Registered Member #87
Joined: Mon Oct 02 2006, 07:34pm
Posts: 157
it would seem that my cellular netowrk provider has blocked ftp access,
most likely by blocking port 21.

and i imagine a lot of other network operators have done the same,
this means i'm going to have to find different way to read/write an online hiscore table.
it's back to the drawing board,

thanks eric for all your help.

[ Edited Sat May 24 2008, 12:17pm ]

the science of play
www.asobitech.com
Back to top
kornalius
Sat May 24 2008, 04:12pm


Registered Member #1
Joined: Wed Apr 19 2006, 08:25pm
Posts: 2783
Use regular port 80 (HTTP), the winsock demo uses it. It is the easiest IMHO.

Regards,
Alain Deschenes
President and programmer
ArianeSoft Inc. (http://www.arianesoft.ca)
Back to top
quangdx
Sun May 25 2008, 12:06am

Registered Member #87
Joined: Mon Oct 02 2006, 07:34pm
Posts: 157
but the question is,
how do I use regulare port 80 (HTTP) to write a file to my website?

the science of play
www.asobitech.com
Back to top
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System