FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC FTP on Pocket PC
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
FTP on Pocket PC
Posted: Mon Aug 28, 2006 06:57 AM
Biel EA6DD wrote:Hello Richard

The cellcore.lib is included in the VCE, you only need to add to your compilation script.

About the connection program, you can use the code posted by Pawel its run perfect. Remember to include "initguid.h" and "connmgr.h" headers.


Thank you

I was searching and not finding on google for cellcore.lib

I will try it.

Gracias
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
FTP on Pocket PC
Posted: Mon Aug 28, 2006 07:00 AM
C:\vce\lib\arm here you have cellcore.lib

Not nececesary to seek, is standard lib installed with the C compiler.
Saludos desde Mallorca
Biel MaimĂł
http://bielsys.blogspot.com/
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 02:05 PM

Hi Enrico,

When trying to send archives the system is stopping! Already I verified that it connects, the archive is servant, but the size is always in ZERO, or either, no byte is sent!

You can help me?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 03:24 PM

No, sorry. As far as I know it should work fine.

EMG

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 04:19 PM
vilian wrote:Hi Enrico,

When trying to send archives the system is stopping! Already I verified that it connects, the archive is servant, but the size is always in ZERO, or either, no byte is sent!

You can help me?


Vilian

Can you show your offending code ?

Ftp works quite ok with fwppc, my app uses it a lot.

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 05:50 PM

Hi Richard,

FUNCTION EnvArqFtp(cArq)
LOCAL hInternet, hConnect

hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )

hConnect = INTERNETCONNECT( hInternet, MyIpServer, INTERNET_INVALID_PORT_NUMBER, MyUser,MyPassword, INTERNET_SERVICE_FTP, 0, 0 )

nRet := FTPPUTFILE( hConnect, CurDir()+"\"+cArq, "/sav/"+cArq, 0, 0 )

INTERNETCLOSEHANDLE( hConnect )

INTERNETCLOSEHANDLE( hInternet )

RETURN NIL

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 05:59 PM
vilian wrote:nRet := FTPPUTFILE( hConnect, CurDir()+""+cArq, "/sav/"+cArq, 0, 0 )


Try using the full destination path.

EMG
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 06:06 PM

Hi Enrico,

"/sav/" this is full destination path.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 06:34 PM

Are you sure? As an example, a path to my website would be

/emagsoftware.it/subdir/test.txt

I think you can't copy a file to the main directory of a website.

EMG

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
FTP on Pocket PC
Posted: Fri Oct 13, 2006 07:15 PM

Hi Enrico,

Thanks for help.

I changed the folder for a sub-folder. The program initiates the transference, the archive is created in the selected folder, but the sending is not finishes, stopping the system!

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
FTP on Pocket PC
Posted: Sat Oct 14, 2006 05:41 AM
vilian wrote:Hi Enrico,

Thanks for help.

I changed the folder for a sub-folder. The program initiates the transference, the archive is created in the selected folder, but the sending is not finishes, stopping the system!


Vilan

Il you are transmitting several files at the same time, yo will need to create one connection per file like the sample below otherwise you will be missing files and it couls hang, i have been through this

FOR I = 1 TO LEN(TFIC)
AADD(HCON,NIL)

hCon[I] = INTERNETCONNECT( hInternet, DSITE,0, DUSER, DPASS, INTERNET_SERVICE_FTP, 0,0 )
IF HCON[I] = 0
MSGINFO("ERREUR Création CONNEXION FTP ... Abandon transmission ")
RETURN .F.
ENDIF

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

HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
FTP on Pocket PC
Posted: Sat Oct 14, 2006 01:27 PM

Hi Richard,

Thanks for help,

I need to send only one archive for time. As already it said before, the archive arrives to be created in the remote directory, but the complete transference not if.

I use a Pocket Dell with WIndows Mobile 2003, what you use?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 126
Joined: Thu Oct 06, 2005 10:18 PM
FTP on Pocket PC
Posted: Sat Oct 14, 2006 02:42 PM

Vilian,

You may use free DataReelCE library. This provide FTP and URL acces function. Don't forget to change transfer type to passive mode.

Regards
Pawel

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
FTP on Pocket PC
Posted: Sun Oct 15, 2006 11:44 AM

Pawel,

You have an example of use of this DLL?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 126
Joined: Thu Oct 06, 2005 10:18 PM
FTP on Pocket PC
Posted: Mon Oct 16, 2006 04:14 PM
Vilian,

This is simple function to do it (I use static libary no DLL):

Regards
Pawel

#pragma BEGINDUMP

#include <gxsftp.h>
#include <dfileb.h>

HB_FUNC (FTPDOWNLOAD)
{
  const char *server = hb_parc (1);
  const char *user = hb_parc (2);
  const char *pass = hb_parc (3);
  const char *file = hb_parc (4);
  gxsFTPClient ftp;
  FAU_t bytes;
  BOOL ret = FALSE;

  ftp.SetTimeOut (10, 0);
  if (ftp.ConnectClient ((const char *) server, 21) == 0)
  {
     ftp.FTPPassive ();
     ftp.FTPImageType ('B');
     if (ftp.FTPLogin ((const char *) user, (const char *) pass) == 0)
     {
        DiskFileB stream ((const char *) file, DiskFileB::df_READWRITE, DiskFileB::df_CREATE);
        if (!stream) ret = FALSE;
        else
        {
           if (ftp.FTPGet ((const char *) file, stream, bytes) != 0) ret = FALSE;
           else ret = TRUE;
        }
        ftp.FTPLogout ();
     }
     else ret = FALSE;
  }
  else ret = FALSE;
  ftp.Close ();
  hb_retl (ret);
}

HB_FUNC (FTPUPLOAD)
{
  const char *server = hb_parc (1);
  const char *user = hb_parc (2);
  const char *pass = hb_parc (3);
  const char *file = hb_parc (4);
  gxsFTPClient ftp;
  FAU_t bytes;
  BOOL ret = FALSE;

  ftp.SetTimeOut (10, 0);
  if (ftp.ConnectClient ((const char *) server, 21) == 0)
  {
     ftp.FTPPassive ();
     ftp.FTPImageType ('B');
     if (ftp.FTPLogin ((const char *) user, (const char *) pass) == 0)
     {
        DiskFileB stream ((const char *) file);
        if (!stream) ret = FALSE;
        else
        {
           if (ftp.FTPPut ((const char *) file, stream, bytes) != 0) ret = FALSE;
           else ret = TRUE;
        }
        ftp.FTPLogout ();
     }
     else ret = FALSE;
  }
  else ret = FALSE;
  ftp.Close ();
  hb_retl (ret);
}

#pragma ENDDUMP