FTP on Pocket PC

Postby Richard Chidiak » Mon Aug 28, 2006 6: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Biel EA6DD » Mon Aug 28, 2006 7: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/
User avatar
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Postby vilian » Fri Oct 13, 2006 2: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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Enrico Maria Giordano » Fri Oct 13, 2006 3:24 pm

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

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

Postby Richard Chidiak » Fri Oct 13, 2006 4: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby vilian » Fri Oct 13, 2006 5: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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Enrico Maria Giordano » Fri Oct 13, 2006 5:59 pm

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


Try using the full destination path.

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

Postby vilian » Fri Oct 13, 2006 6:06 pm

Hi Enrico,

"/sav/" this is full destination path.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Enrico Maria Giordano » Fri Oct 13, 2006 6: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
User avatar
Enrico Maria Giordano
 
Posts: 8310
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby vilian » Fri Oct 13, 2006 7: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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Richard Chidiak » Sat Oct 14, 2006 5: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby vilian » Sat Oct 14, 2006 1: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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby pawelu » Sat Oct 14, 2006 2: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
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

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

Postby pawelu » Mon Oct 16, 2006 4:14 pm

Vilian,

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

Regards
Pawel

Code: Select all  Expand view
#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
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

PreviousNext

Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 2 guests