FTP Again

FTP Again

Postby Colin Haig » Thu Jul 09, 2009 9:35 am

Hi All

Still having a problem sending a file from a Samsung Omnia using Windows Mobile 6.1
this is the code I am using - I dont get any errors but the file is never transferred.

Any ideas greatfully accepted.


static function Connect()
LOCAL hInternet, hConnect

hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
if hInternet == 0
MsgInfo('No Internet')
endif

hConnect = INTERNETCONNECT( hInternet,"99.9.9.99",INTERNET_DEFAULT_FTP_PORT, "user", "pass", INTERNET_SERVICE_FTP,0, 0 )
IF HConnect == 0
MSGINFO("Error on FTP Connection ")
RETURN .F.
ENDIF
FTPPUTFILE( hConnect, "\\My Storage\\mobapp\\user.dbf", "user.dbf", 0, 0 )

INTERNETCLOSEHANDLE( hConnect )

INTERNETCLOSEHANDLE( hInternet )

RETURN NIL

Regards

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

Re: FTP Again

Postby Enrico Maria Giordano » Thu Jul 09, 2009 3:51 pm

Try passive mode:

Code: Select all  Expand view
#define INTERNET_FLAG_PASSIVE 134217728

hConnect = INTERNETCONNECT( hInternet,"99.9.9.99",INTERNET_DEFAULT_FTP_PORT, "user", "pass", INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE, 0 )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP Again

Postby Colin Haig » Fri Jul 10, 2009 1:08 am

Hi Enrico

Thanks for that suggestion but still no luck - I changed the code to give a return value from
ftpputfile and it always returns false - I have tried sending the file to two different servers and
still no luck - they are both windows 2003 servers.

I have used the tip class (xHarbour) to ftp file from within my normal fivewin app and that works fine to both
servers. I have tried the ftp at command line to connect to both servers and that works.

Can it be the path settings for the files that is causing an issue - or can you reccomend another way
of testing it.

Do you know if there is a ftp program that works on windows mobile so I could just make sure the device can
actually ftp.

Thanks for any help and assistance

regards

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

Re: FTP Again

Postby Enrico Maria Giordano » Fri Jul 10, 2009 9:11 am

Code: Select all  Expand view
FTPPUTFILE( hConnect, "\\My Storage\\mobapp\\user.dbf", "user.dbf", 0, 0 )


Try to provide the correct full path for the remote file (third parameter).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP Again

Postby Colin Haig » Sat Jul 11, 2009 4:40 am

Hi Enrico

I think I have tried every combination of paths - I downloaded a ftp client and tested that
and it works fine.

So I am not sure what to try next.

Thanks for your suggestions.

Regards

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

Re: FTP Again

Postby Enrico Maria Giordano » Sat Jul 11, 2009 9:37 am

Please build a reduced and self-contained sample of the problem and show it here.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP Again

Postby Colin Haig » Sun Jul 12, 2009 1:08 am

Hi Enrico

Here is the code - I have removed as much as possible
There is a sub folder called BMP - c:\mobapp\bmp

Thanks for your assistance

Colin

#define FILE_ATTRIBUTE_READONLY 1
#define FILE_ATTRIBUTE_HIDDEN 2
#define FILE_ATTRIBUTE_SYSTEM 4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE 32
#define FILE_ATTRIBUTE_NORMAL 128
#define FILE_ATTRIBUTE_TEMPORARY 256

//
// access types for InternetOpen()
//

#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


//
// manifests
//

#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.


//
// service types for InternetConnect()
//

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

#define INTERNET_FLAG_PASSIVE 134217728

//
// flags for FTP
//

#define INTERNET_FLAG_TRANSFER_ASCII 1
#define INTERNET_FLAG_TRANSFER_BINARY 2



#define SHFS_HIDETASKBAR 2 // 0x0002 //2
#define SHFS_SHOWSIPBUTTON 4 // 0x0004
#define SHFS_HIDESIPBUTTON 8 // 0x0008 //8
#define SHFS_SHOWSTARTICON 16 // 0x0010
#define SHFS_HIDESTARTICON 20 // 0x0020 //
#define TRUE .T.
#define FALSE .F.
#include "C:\FWPPC\INCLUDE\FWCE.CH"
static oWnd
function Main()
local oFont
REQUEST DBFCDX,DBFFPT
RddSetDefault('DBFCDX')
config()
use(curdir() +'\user')
cIntls := user->intls
cName := user->employee
use
DEFINE FONT oFont NAME "Cambria" SIZE 0,-9
DEFINE WINDOW oWnd

ShFullScreen(oWnd:hwnd,SHFS_HIDESTARTICON )
ShFullScreen(oWnd:hwnd,SHFS_HIDETASKBAR )


ACTIVATE WINDOW oWnd ;
ON INIT(MoveWindow(oWnd:hWnd,0,0,300,320),;
Control())


dbCloseall()
oFont:end()
return nil
//---------------------------------------------------------------------------//
function config()
set date british
set softseek on
set confirm on
set deleted on
set century on
set epoch to 1960
return(nil)
//---------------------------------------------------------------------------//
static function Control()
local lClean := FALSE

@50,25 BTNBMP FILE Curdir() +'\bmp\clock_red.bmp' SIZE 28, 28 OF oWnd ;
ACTION(Timesheets(cIntls,cName))

@50,100 BTNBMP FILE Curdir() +'\bmp\transmit.bmp' SIZE 28, 28 OF oWnd ;
ACTION(Connect())

@50,175 BTNBMP FILE Curdir() +'\bmp\group.bmp' SIZE 28, 28 OF oWnd ;
ACTION(ShowAll(cIntls,cName))

@100,25 BTNBMP FILE Curdir() +'\bmp\house.bmp' SIZE 28, 28 OF oWnd ;
ACTION(lClean := FALSE,Maint(lClean))

@100,100 BTNBMP FILE Curdir() +'\bmp\delete.bmp' SIZE 28, 28 OF oWnd ;
ACTION(lClean := TRUE,Maint(lClean))

@100,175 BTNBMP FILE Curdir() +'\bmp\exit.bmp' SIZE 28, 28 OF oWnd ;
ACTION(dbCloseAll(),oWnd:end())

return(nil)
//---------------------------------------------------------------------------//
static function Timesheets(cIntls,cName)
MsgInfo('timesheet code')
return(nil)
//--------------------------------------------------------------//
static function ShowAll()
MsgInfo('display all records in browse')
return(nil)
//-----------------------------------------------------------------//
static function files()
MsgInfo('check for indexes')
return(nil)
//---------------------------------------------------------------------------------------//
static function Maint(lClean)
MsgInfo('re index')
RETURN(NIL)
//-----------------------------------------------------------------------------------------//
static function Connect()
LOCAL hInternet, hConnect

// I have tried "anystring" as well as the IP

hInternet = INTERNETOPEN( "99.9.9.999", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
if hInternet == 0
MsgInfo('No Internet')
endif

hConnect = INTERNETCONNECT( hInternet,"99.9.9.999",INTERNET_DEFAULT_FTP_PORT, "admin", "#pass",
INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE, 0 )
IF HConnect == 0
MSGINFO("Error on FTP Connection ")
RETURN .F.
ENDIF
if ! FTPPUTFILE( hConnect, "\\My Storage\MobApp\error.txt", "c:\fpt\error.txt", 0, 0 )
MsgAlert('FTP failed') // fails here
endif
INTERNETCLOSEHANDLE( hConnect )
INTERNETCLOSEHANDLE( hInternet )
RETURN(NIL)
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: FTP Again

Postby Enrico Maria Giordano » Sun Jul 12, 2009 9:34 am

Code: Select all  Expand view
FTPPUTFILE( hConnect, "\\My Storage\MobApp\error.txt", "c:\fpt\error.txt", 0, 0 )


This is wrong. The third parameter must be the remote file in FTP format (ie. /emagsoftware.it/ftp/error.txt on my website).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP Again

Postby Colin Haig » Sun Jul 12, 2009 10:59 am

Hi Enrico

Thanks that worked - I must have googled for ages trying to get a sample of the
path - I thought the / was for Linux boxes - anyway I just changed my code to "/error.txt"
and it worked.

Thanks for your patience.

Cheers

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


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 8 guests