FTP

FTP

Postby Colin Haig » Sat Jun 27, 2009 6:26 am

Hi All

I have an application running on a Samsung Omnia Mobile phone running windows 6 - I am trying to setup FTP
from the phone back to a windows server - using the sample code by Enrico but I cant get hConnect to return a value

hConnect = INTERNETCONNECT( hInternet, "myIP",INTERNET_DEFAULT_FTP_PORT, "myUser", "myPass", INTERNET_SERVICE_FTP,0, 0 )

In a desktop app - I use the tip library to connect back to the same server and have no problems

#include "tip.ch"
function send()
local cServer := '',cUser := '',cPassword := '',oUrl,oFtp,cFile := 'error.log'

cServer := myIP
cUser := myUser
cPassword := myPass
cUrl := "ftp://" + cUser + ":" + cPassword + "@" + cServer

oUrl := tUrl():New(cUrl)
oFtp := tIPClientFtp():New(oUrl,.t.)
oFtp:nConnTimeout := 20000
oFtp:bUsePasv := .t.
oFtp:lTrace := .f.

if oFtp:open(cUrl)
if oFtp:UpLoadFile((cFile))
oFtp:close()
endif
else
?? 'Error openning url'
wait
endif
return(nil)

Thanks for any ideas.

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: FTP

Postby Richard Chidiak » Sat Jun 27, 2009 11:23 am

Colin

I am not sure tip class is compatible with fwppc, this is a sample of using ftp with fwppc (works with my app since long time)

HTH

Richard

Code: Select all  Expand view


#define INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
#define INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS

#define INTERNET_INVALID_PORT_NUMBER    0           // use the protocol-specific default

#define INTERNET_DEFAULT_FTP_PORT       21          // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT    70          //    "     " gopher "
#define INTERNET_DEFAULT_HTTP_PORT      80          //    "     " HTTP   "
#define INTERNET_DEFAULT_HTTPS_PORT     443         //    "     " HTTPS  "
#define INTERNET_DEFAULT_SOCKS_PORT     1080        // default for SOCKS firewall servers.

#define INTERNET_SERVICE_FTP     1
#define INTERNET_SERVICE_GOPHER  2
#define INTERNET_SERVICE_HTTP    3

#define INTERNET_FLAG_TRANSFER_ASCII  1
#define INTERNET_FLAG_TRANSFER_BINARY 2

Internet := InternetOpen( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
IF hINTERNET = 0
   MSGINFO("ERROR ON CONNEXION")
   RETURN .F.
ENDIF

hCon1 = INTERNETCONNECT( hInternet, MYSITE,INTERNET_INVALID_PORT_NUMBER, MYUSER, MYPASS, INTERNET_SERVICE_FTP, 0,0 )
IF HCON1 = 0
   MSGINFO("ERREUR ON CONNEXION FTP  ")
   RETURN .F.
ENDIF

// RETREIVE THE FILES HERE

INTERNETCLOSEHANDLE( hCon1 )
INTERNETCLOSEHANDLE( hInternet )

 
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: FTP

Postby Colin Haig » Sat Jun 27, 2009 2:04 pm

Hi Richard

Thanks for your sample code - I still cant get the HCON1 to work - I get a
hInternet value - is there any other settings on the phone I should look at ,
I have the browser set to WAP and have tested I can get a website on the phone.

Regards

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: FTP

Postby Richard Chidiak » Mon Jun 29, 2009 4:59 am

Colin

Check the website spelling, www...... better thant ftp...... , userid and password and the location directory, if you are connecting to a linux server "/" for directory etc...

HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: FTP

Postby Antonio Linares » Mon Jun 29, 2009 5:58 am

Colin,

Are you able to access the web from your emulator or your phone ?

have you tried to access ftp.microsoft.com for reading ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 4 guests