Help: getting updates from a remote server.

Help: getting updates from a remote server.

Postby HunterEC » Tue Oct 21, 2008 6:15 am

I'm having my first steps with FiveWin / xHarbour. :oops:
My customers need to download updated data from our servers to keep their database up to date. Is there is a way that they can download their data (if entitled to, subscription based) automatically ? Something like anti-virus software does it ? How can this be done using FiveWin ?
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Help: getting updates from a remote server.

Postby Sheng » Tue Oct 21, 2008 9:42 am

HunterEC wrote:I'm having my first steps with FiveWin / xHarbour. :oops:
My customers need to download updated data from our servers to keep their database up to date. Is there is a way that they can download their data (if entitled to, subscription based) automatically ? Something like anti-virus software does it ? How can this be done using FiveWin ?


you can use tftp class to get files.
Sheng
 
Posts: 15
Joined: Mon Sep 29, 2008 1:41 pm

Re: Help: getting updates from a remote server.

Postby Davide » Tue Oct 21, 2008 11:05 am

HunterEC wrote:Is there is a way that they can download their data (if entitled to, subscription based) automatically ?

In addition to tftp you can even use tWebClient and the IE-ActiveX to retrieve remotely hosted files.
Regards,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby hag » Wed Oct 22, 2008 2:26 am

Can you post some code on how this might be done. Thanks

Harvey
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Sheng » Wed Oct 22, 2008 3:14 am

hag wrote:Can you post some code on how this might be done. Thanks

Harvey

Code: Select all  Expand view
              // Create ftp connect
              oFtp := TFtp():New( cFTP_IP, oInternet, cUsername, cPassword )
              If oFtp:hFtp == 0
                 Tone( 1000, 1 )
                 MsgStop( "Ftp connect fail!", "Error!" )
                 oFtp:End()
                 Exit
              EndIf
              :
              :
              :
              // Open remote file
              oFtpFile := TFtpFile():New( cServerFile, oFtp )
              oFtpFile:lBinary := .T.
              //
              oFtpFile:OpenRead()      // Open and Read mode
                  If oFtpFile:nError <> 0
                  Tone( 1000, 1 )
                  MsgStop( "ftp file:["+cServerFile+"]Open & read fail!!", "Error!" )
                  oFtpFile:End()
                  lRet := .F.
                  Exit
               EndIf
Sheng
 
Posts: 15
Joined: Mon Sep 29, 2008 1:41 pm

Postby hag » Wed Oct 22, 2008 3:43 am

Sheng:

Thanks for the data. I'll give it a try in a couple of days. Thanks again.

Harvey
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby HunterEC » Wed Oct 22, 2008 5:28 am

Davide, Hag, Sheng: thank you all. I'll give it a try. :D
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Postby Davide » Wed Oct 22, 2008 1:27 pm

hag wrote:Can you post some code on how this might be done.

TWebClient allows you retrieving a file via the standard http port 80. Please see \fwh\samples\webclien.prg
For the IE-ActiveX you need the most recent FWH. Antonio has posted a sample at: http://www.fivetechsoft.com/forums/viewtopic.php?t=12514
Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby ShumingWang » Thu Oct 23, 2008 1:08 am

hi,
If webclient / TFTP can overwrite even if the file is open or at running ?
For example: my.exe ,my.dll,libmysql.dll are running, overwrite them besides they are running.
Under Linux ,could.

Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby hag » Sun Oct 26, 2008 6:41 pm

Sheng:

You posted some code here. Could you post the complete function so I can see what the values for the variables come from.

Thanks

Your Code
Code: Select all  Expand view
// Create ftp connect
              oFtp := TFtp():New( cFTP_IP, oInternet, cUsername, cPassword )
              If oFtp:hFtp == 0
                 Tone( 1000, 1 )
                 MsgStop( "Ftp connect fail!", "Error!" )
                 oFtp:End()
                 Exit
              EndIf
              :
              :
              :
              // Open remote file
              oFtpFile := TFtpFile():New( cServerFile, oFtp )
              oFtpFile:lBinary := .T.
              //
              oFtpFile:OpenRead()      // Open and Read mode
                  If oFtpFile:nError <> 0
                  Tone( 1000, 1 )
                  MsgStop( "ftp file:["+cServerFile+"]Open & read fail!!", "Error!" )
                  oFtpFile:End()
                  lRet := .F.
                  Exit
               EndIf


User and pass word i understand.
What about: cFTP_IP, cServerfile what are these values?
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Sheng » Mon Oct 27, 2008 1:40 am

hag wrote:Sheng:

You posted some code here. Could you post the complete function so I can see what the values for the variables come from.

Thanks

Your Code
Code: Select all  Expand view
// Create ftp connect
              oFtp := TFtp():New( cFTP_IP, oInternet, cUsername, cPassword )
              If oFtp:hFtp == 0
                 Tone( 1000, 1 )
                 MsgStop( "Ftp connect fail!", "Error!" )
                 oFtp:End()
                 Exit
              EndIf
              :
              :
              :
              // Open remote file
              oFtpFile := TFtpFile():New( cServerFile, oFtp )
              oFtpFile:lBinary := .T.
              //
              oFtpFile:OpenRead()      // Open and Read mode
                  If oFtpFile:nError <> 0
                  Tone( 1000, 1 )
                  MsgStop( "ftp file:["+cServerFile+"]Open & read fail!!", "Error!" )
                  oFtpFile:End()
                  lRet := .F.
                  Exit
               EndIf


User and pass word i understand.
What about: cFTP_IP, cServerfile what are these values?


cFtp_IP: is ftp server ip or domain name.
cServerFile: is filename at ftp server.
Sheng
 
Posts: 15
Joined: Mon Sep 29, 2008 1:41 pm

Postby HunterEC » Sat Nov 01, 2008 9:37 am

Guys:

Thank you all for your help. I'll give it a try. :D
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests