Page 2 of 3

Posted: Mon Aug 28, 2006 6:57 am
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

Posted: Mon Aug 28, 2006 7:00 am
by Biel EA6DD
C:\vce\lib\arm here you have cellcore.lib

Not nececesary to seek, is standard lib installed with the C compiler.

Posted: Fri Oct 13, 2006 2:05 pm
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?

Posted: Fri Oct 13, 2006 3:24 pm
by Enrico Maria Giordano
No, sorry. As far as I know it should work fine.

EMG

Posted: Fri Oct 13, 2006 4:19 pm
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

Posted: Fri Oct 13, 2006 5:50 pm
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

Posted: Fri Oct 13, 2006 5:59 pm
by Enrico Maria Giordano
vilian wrote:nRet := FTPPUTFILE( hConnect, CurDir()+""+cArq, "/sav/"+cArq, 0, 0 )
Try using the full destination path.

EMG

Posted: Fri Oct 13, 2006 6:06 pm
by vilian
Hi Enrico,

"/sav/" this is full destination path.

Posted: Fri Oct 13, 2006 6:34 pm
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

Posted: Fri Oct 13, 2006 7:15 pm
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!

Posted: Sat Oct 14, 2006 5:41 am
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

Posted: Sat Oct 14, 2006 1:27 pm
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?

Posted: Sat Oct 14, 2006 2:42 pm
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

Posted: Sun Oct 15, 2006 11:44 am
by vilian
Pawel,

You have an example of use of this DLL?

Posted: Mon Oct 16, 2006 4:14 pm
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