tftp class

Postby Antonio Linares » Tue Jan 30, 2007 5:01 pm

Vilian,

Please review FWPPC\samples\Ftp.prg
regards, saludos

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

Postby vilian » Tue Jan 30, 2007 5:42 pm

Antonio,

The FWPPC\samples\Ftp.prg does not function. The file is created in directory FTP but it is with size zero and program congeals.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Jan 30, 2007 6:11 pm

Vilian,

Enrico developed ftp.prg sample, we may ask him. Enrico ?
regards, saludos

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

Postby Enrico Maria Giordano » Tue Jan 30, 2007 7:13 pm

It should work fine, as far as I know. Sorry, I haven't a pocket PC to test it. My friend Andrea Bruni tested it. Let me ask him... Done. I will report any answer here.

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

Postby Richard Chidiak » Tue Jan 30, 2007 7:15 pm

Vilian

This is a working sample :)

My app uses ftp very intensively and it works OK.

FUNCTION RLOGTRN(TPAR,TFICLOG) // Récupérer FICHIERS LOGTRN QUI INDIQUENT CE QU'IL Y A à TéLécharger
LOCAL hInternet,DFIC,DFICL,DFICR, ;
I := 0, ;
J := 0, ;
DSITE := SPACE(100), ;
DUSER := SPACE(30), ;
DPASS := SPACE(10), ;
DDIR := SPACE(100), ;
HCON

local oInternet
local oFTP
local aFiles

DSITE := ALLTRIM(TPAR[08])
DUSER := ALLTRIM(TPAR[09])
DPASS := ALLTRIM(TPAR[10])
DDIR := ALLTRIM(TPAR[11])

oInternet := TInternet():New()
oFTP := TFTP():New( DSITE, oInternet, DUSER, DPASS )

if ! Empty( oFTP:hFTP )
aFiles = oFTP:Directory(DDIR)
endif

if ! Empty( oFTP:hFTP )
aFiles = oFTP:Directory( ddir + "LOGTRN*.*" )
endif
oInternet:End()

hInternet := InternetOpen( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 ) // pocket connexion gprs
IF hINTERNET = 0
MSGINFO("ERREUR CONNEXION INTERNET")
RETURN NIL
ENDIF

hCon = INTERNETCONNECT( hInternet, DSITE,INTERNET_INVALID_PORT_NUMBER, DUSER, DPASS, INTERNET_SERVICE_FTP, 0,0 )
IF HCON = 0
MSGSTOP("Trop de connexion en cours, essayez plus tard !")
RETURN NIL
ENDIF

J := 0
FOR I = 1 TO LEN(AFILES)
IFILE := AFILES[I]
DFIC := ALLTRIM(IFILE[1])
IF SUBS(DFIC,1,1) = "." .OR. ASC(SUBS(DFIC,1,1)) = 0
ELSE
DFICL := CurDir() + "\ENTRANT\" + alltrim(dfic) // LOCAL FILE
DFICR := ALLTRIM(DDIR ) + alltrim(dfic) // REMOTE FILE

AADD(TFICLOG,DFIC) // STOCKER NOM FICHIER DANS TABLEAU POUR EFFACER APRES SYNCRO
FTPGETFILE( hCon, DFICR , DFICL, 0,FILE_ATTRIBUTE_ARCHIVE, 0, 0 )
ENDIF
NEXT

INTERNETCLOSEHANDLE( hCon )
INTERNETCLOSEHANDLE( hInternet )
return nil


PS : if you need other samples, please let me know

HTH

Richard


Ps : For ANTONIO

Enrico's sample is excellent but it will not work together with tftp class (using the same function names)
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

Postby Antonio Linares » Tue Jan 30, 2007 7:26 pm

Richard,

We removed Enrico's sample function names as now wininet.prg is inside FWPPC
regards, saludos

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

Postby vilian » Wed Jan 31, 2007 2:12 pm

Richard,

I need a example of the FtpPutFile function. You have?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Richard Chidiak » Wed Jan 31, 2007 2:17 pm

Here you have it

FUNCTION EINTERN(TPAR,TFIC,LOGOUT) // ENVOI SYNCRO PAR INTERNET DU POCKET VERS LE PC DOSSIER CURDIR() + "\SORTANT\*.* a syncroniser vers dest dans aval (tpar))
LOCAL hInternet,DFICL,DFICR, ;
HCON := {}, ;
I := 0, ;
CTR := 0, ;
DSITE := SPACE(100), ;
DUSER := SPACE(30), ;
DPASS := SPACE(10), ;
DDIR := SPACE(100), ;
HCON1



// TPAR[01] := PKID->IDCBATIPK
// TPAR[02] := PKID->PKPC
// TPAR[03] := PKID->PKPCSITE
// TPAR[04] := PKID->PKPCUSER
// TPAR[05] := PKID->PKPCPASS
// TPAR[06] := PKID->PKPCDIR
// TPAR[07] := PKID->PCPK
// TPAR[08] := PKID->PCPKSITE
// TPAR[09] := PKID->PCPKUSER
// TPAR[10] := PKID->PCPKPASS
// TPAR[11] := PKID->PCPKDIR

DSITE := ALLTRIM(TPAR[03])
DUSER := ALLTRIM(TPAR[04])
DPASS := ALLTRIM(TPAR[05])
DDIR := ALLTRIM(TPAR[06])

hInternet := InternetOpen( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 ) // pocket connexion gprs

hCon1 = INTERNETCONNECT( hInternet, DSITE,0, DUSER, DPASS, INTERNET_SERVICE_FTP, 0,0 )
IF HCON1 = 0
MSGINFO("ERREUR Création CONNEXION FTP ... Abandon transmission ")
RETURN .F.
ENDIF

FOR I = 1 TO LEN(TFIC)
DFICL := CurDir() + "\SORTANT\" + ALLTRIM(TFIC[I]) // Fichier local
DFICR := ALLTRIM(DDIR) + ALLTRIM(TFIC[I]) // FICHIER REMOTE
IF FTPPUTFILE( hCon1, DFICL, DFICR, 0, 0 )
AADD(LOGOUT,TFIC[I])
ENDIF
NEXT

INTERNETCLOSEHANDLE( hCon1 )
INTERNETCLOSEHANDLE( hInternet )
RETURN .T.

Regards

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

Postby Richard Chidiak » Wed Jan 31, 2007 2:21 pm

You may need this also

#include "C:\FWPPC\INCLUDE\FWCE.ch"

#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


//
// flags for FTP
//

#define INTERNET_FLAG_TRANSFER_ASCII 1
#define INTERNET_FLAG_TRANSFER_BINARY 2
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

Postby vilian » Wed Jan 31, 2007 2:50 pm

Richard,

The file is created in directory FTP but it is with size zero and program congeals.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Enrico Maria Giordano » Wed Jan 31, 2007 3:38 pm

EnricoMaria wrote:It should work fine, as far as I know. Sorry, I haven't a pocket PC to test it. My friend Andrea Bruni tested it. Let me ask him... Done. I will report any answer here.

EMG


Andrea Bruni confirmed that my sample works fine.

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

Postby Richard Chidiak » Wed Jan 31, 2007 3:43 pm

Vilian

Make sure you have the correct access on the server where you want to put the file and that there is no "Disk Quota" or something similar.

The code i sent you works OK.

We have several customers that use it, they send maintenance data from their pocket (via our application) to our server and receive back some other data. FWPPC works OK on this.

The only problem i can not handle properly at the moment is closing the gprs connexion (when used) "Always" . From time to time it remains open. I am working on it.

Hth

PS : What type of server are you uisng ? Linux ? Plex system ?

If using a plex system, make sure you address the main domain "userid and password", if not create sub domains

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

Postby vilian » Wed Jan 31, 2007 6:14 pm

Richard,

We use Windows 2003 server. We are using the Activesync to connect the Pocket our net.

We obtain to have access directory ftp through IExplorer the Pocket.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » Thu Feb 08, 2007 1:19 pm

Richard,

It forgives the insistence, but still I did not obtain to send archives saw ftp.

I have that to make some special configuration in mine pocket ?

You can execute in its pocket the example that I mounted to see if the archive arrives complete in my site?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 978
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Richard Chidiak » Thu Feb 08, 2007 7:18 pm

Hello Vilian

Sorry i was on vacation for the last week. Needed some sunshine...

Back to FTP,

If you are connected to the PC (window 2003 server) from your pocket, then you are on a "local" connexion, in this case, ftp wil not work. You will need just a copy file to copy from the pocket to windows 2003 server. This is what we do when the pocket is local (never use ftp in local mode, we use cecopy instead to copy from the PC to the pocket)

Just make sure your pocket is "not connected" to the pc when you want to use ftp.

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

PreviousNext

Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 3 guests