FTP on Pocket PC

User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

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
User avatar
Biel EA6DD
Posts: 680
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca
Contact:

Post by Biel EA6DD »

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/
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Post by vilian »

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
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Post by vilian »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

vilian wrote:nRet := FTPPUTFILE( hConnect, CurDir()+""+cArq, "/sav/"+cArq, 0, 0 )
Try using the full destination path.

EMG
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Post by vilian »

Hi Enrico,

"/sav/" this is full destination path.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Post by vilian »

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
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

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 = INTERNETCONNECT( hInternet, DSITE,0, DUSER, DPASS, INTERNET_SERVICE_FTP, 0,0 )
IF HCON = 0
MSGINFO("ERREUR Création CONNEXION FTP ... Abandon transmission ")
RETURN .F.
ENDIF

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

HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Post by vilian »

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
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Post by vilian »

Pawel,

You have an example of use of this DLL?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Vilian,

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

Regards
Pawel

Code: Select all

#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
Post Reply